Questions tagged [integration]
For questions related to integration on computers. This can include numerical approximations of integrals (e.g. Monte Carlo, quadrature, FEM, RK4) and algorithms/software to obtain analytical derivatives (Risch algorithm, SymPy).
211
questions
3
votes
0
answers
118
views
Quantifying the inefficiency of Gauss–Hermite quadrature
I am trying to understand the following part of the paper https://doi.org/10.1137/20M1389522 where the author argues about the inefficiency of Gauss-Hermite quadrature.
I think I get the gist of the ...
2
votes
0
answers
63
views
Understanding proof of the error bound for Simpson's quadrature rule
I have found the following proof of the error bound for Simpson's quadrature rule:
Using Newton's interpolation method, we derive a cubic polynomial $p_3(x)$ that interpolates $f(x)$ at the points $a, ...
0
votes
1
answer
59
views
solve_ivp method=ODE23 time step not decreasing in order
My time step with the function scipy.integrate.solve_ivp is not decreasing in t_span fluctuating (reaching values below or ...
6
votes
2
answers
972
views
Implementation of Monte-Carlo Integration
After reading the Wikipedia page for Monte-Carlo integration, I have understood the basic idea but I am having trouble implementing it for a general case.
The integration that I am trying to do is
$$
\...
2
votes
0
answers
98
views
Calculating Debye functions to high accuracy (hundreds of bits), is it possible to be faster than generic quadrature?
The Debye functions are defined like so: ${D_n\left(x\right)} = {\frac{n}{x^n} \cdot {\int_0^x{\frac{t^n}{e^t - 1}dt}}}$.
I'm trying to evaluate the functions for $n$ from one to four and for $\left\...
2
votes
2
answers
76
views
How to improve and stabilize this code simulating a damped mass-spring oscillator? Runge-Kutta?
I wrote the following function which is simulating a damped mass-spring oscillator. It is being driven by the audio sample input at 44.1 kHz sampling to create the same effect as a resonant bandpass ...
0
votes
0
answers
104
views
How to minimize a numerical integration in python?
I need some help to minimize a numerical integration. It's about a classical problem in physics (hydrogen atom). It can be solved analytically but I need to solve it numerically in Python.
We have an ...
0
votes
2
answers
2k
views
When can I use finite differences for differentiation?
Finite differences are usually used to integrate ODE's and PDE's. However, sometimes they can be used for differentiation which I illustrated simply by using the Matlab code below to differentiate the ...
0
votes
1
answer
99
views
How to use a custom OdeSolver in Scipy's solve_ivp
In Scipy's solve_ivp documentation, we see the method argument can be either a string or a user-defined ...
3
votes
1
answer
170
views
Optimal quadrature rule for heavy tail measure
I'm looking for a well-thought quadrature rule for this measure
$d\mu(t)=\frac{dt}{t^s}$ for $s\in(0,1)$, the underlying motivation is to compute this integral
$$
\lambda^{s-1}=\frac{1}{\Gamma(1-s)}\...
0
votes
0
answers
125
views
Am I doing leapfrog integration correctly?
I wrote this minimal example to examine the Leapfrog integration algorithm.
However, I am not sure it is the correct algorithm, and the listing is giving the correct output.
Is this the Leapfrog ...
2
votes
2
answers
1k
views
Understanding leapfrog integration algorithm
The leapfrog.cpp is an implementation of leapfrog integration algorithm where f() function is being integrated:
leapfrog.cpp
<...
0
votes
0
answers
146
views
Solving system of ODEs, where time derivative approaches infinity due top initial condition
I am trying to solve a problem in python using scipy's solve_ivp. The system of ODEs I am trying to solve is for coupled where I am solving for two time-dependent ...
2
votes
1
answer
250
views
2D integrals in Python with specified points of interest
Note: This is my first question on stackexchange; please tell me if I'm doing something incorrectly.
I am trying to calculate a series of a 2D integrals in Python with an integrand that has several ...
2
votes
2
answers
445
views
Solving IVP backward in time via python
I'm having difficulty solving an initial value problem (IVP) in Python backwards in time.
The code is at the end of this post.
First, please let me state my simplified problem.
The forward IVP is ...