Skip to main content
The 2024 Developer Survey results are live! See the results

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).

0 votes
0 answers
42 views

Projecting the initial state on a Discontinuous Galerkin basis

Context I want to solve a 1D Burgers equation with a discontinuous Galerkin approach on the space-time domain $(x,t)\in [0,1]^2$. I want to project the function $u(x) = e^{-\frac{(x-0.5)^2}{0.02}}$ ...
L Maxime's user avatar
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 ...
Loik's user avatar
  • 31
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, ...
codeing_monkey's user avatar
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 ...
louis gouders's user avatar
6 votes
2 answers
973 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 $$ \...
Michael's user avatar
  • 71
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\...
user2373145's user avatar
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 ...
mikejm's user avatar
  • 123
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 ...
Rubens Filho's user avatar
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 ...
FriendlyNeighborhoodEngineer's user avatar
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 ...
Axel Wang's user avatar
  • 197
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)}\...
Aner's user avatar
  • 181
0 votes
0 answers
127 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 ...
user366312's user avatar
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 <...
user366312's user avatar
0 votes
0 answers
149 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 ...
HWIK's user avatar
  • 23
2 votes
1 answer
256 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 ...
Feathers's user avatar