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

208 questions
5
votes
0 answers

Why does this integral converge faster than normal rectangle or trapz integration?

I was looking for the fastest converging method to integrate a family of functions. After some tries, an old-school colleague suggested me a method that he used to use in excel to perform such task. It relies on a simple procedure: sample the…
Luca
  • 151
  • 3
5
votes
0 answers

Is there a numerically stable way to take $\epsilon \rightarrow 0$ in integrals of the form $\int \frac{f(x)dx}{x+i\epsilon}$?

The Sokhotski-Plemelj theorem states, $$\lim_{\epsilon\rightarrow 0^+}\int_a^b\frac{f(x)dx}{x+i\epsilon} = \mathcal P \int_a^b \frac{f(x)dx}{x} - i\pi f(0). $$ Is there a numerically stable way to take this limit, without explicitly using the above…
interoception
  • 201
  • 1
  • 3
4
votes
4 answers

Trapezoid rule vs Gaussian quadrature: what am I missing?

I'm reading a paper right now which criticizes a method because it uses trapezoid rule, rather than "more advanced quadrature rules like the Gauss quadrature"... The Gaussian quadrature rule requires, given $N$, the calculation of a bunch of weights…
Vazuoeow
  • 51
  • 2
4
votes
1 answer

How to solve this set of equations involving an integral?

I have the following set of equations: $$ x(t) = x_0 \psi, \qquad y(t) = \kappa \ln \psi - x_0 \psi +1,\qquad z(t) =-\kappa\ln \psi,$$ with $$ t- t_0 = \int ^\psi_{\psi_0} \frac{d\eta}{\eta(1+\kappa\ln \eta + x_0 \eta)}. $$ Here $t$ represents…
AngusTheMan
  • 143
  • 4
3
votes
1 answer

Composite simpson's rule with odd intervals

The composite simpson's rule subdivides the interval into n equal subintervals, with n even. Then $$\int_a^b f(x) dx \approx \frac{h}{3}[f(x_0) + 4f(x_1) + 2f(x_2) + 4f(x_3) + ... + 2f(x_{n-2}) + 4f(x_{n-1}) + f(x_n)] $$ (where $x_0 = a$ and…
bernie
  • 165
  • 1
  • 1
  • 6
2
votes
1 answer

How to compute line integral over circle

I have a discrete 2D temperature field, i. e. a dataset of N points (x, y, T). I would like to compute line integrals at fixed radii, $\int_0^{2\pi}T(r,\theta)d\theta$. My first thought was to transform all coordinates into radial coordinates, and…
akid
  • 719
  • 4
  • 15
2
votes
1 answer

Numerical integration of sharp peaked function (position of peak known)?

What methods are available to integrate a sharply peaked function (position of peak known) on a finite interval (the interval includes the peak)? Currently I am getting underflows using some of GSL's adaptive algorithms. I suspect that GSL fails to…
a06e
  • 1,729
  • 15
  • 22
1
vote
0 answers

Why can we remove the half-step velocity in velocity Verlet

Eliminating the half-step velocity, this algorithm may be shortend to Why can we eliminate the half-step velocity and all the math behind the velocity Verlet to what Wikipedia shows?
ght007
  • 95
  • 4
1
vote
0 answers

Numerical integration of a 2D hemisphere discrete dataset where limits are unknown

I am trying to compute the integral of a 2D hemisphere dataset $f_r \, (\theta, \phi)$ where $\theta \in [0, \pi / 2[$ and $\phi \in [0, 2\pi]$. I am making the measurements myself, so I can choose the number of values and their coordinates. My…
Balfar
  • 63
  • 5
1
vote
1 answer

Definite Numerical Integration with Unknown limit

How to solve for small gamma in the integral equation in Scipy ? I recognize it has to be solved with both the numerical integral and a root solver (Newton's method) $$ \int_{\gamma}^{+\infty}f(x) dx = 0.01 $$ The function f isn't a known analytical…
1
vote
1 answer

Numerical integration of a quadratic form exponential in two variables over a rectangle

Let $$f(x,y) = \exp \left(- \frac{1}{2}a x^2 - \frac{1}{2}c y^2 + bxy \right)$$ where $a,b,c\ge 0$. I want to integrate numerically: $$\int_{x_0}^{x_1}\mathrm{d}x \int_{y_0}^{y_1}\mathrm{d}y \, f(x,y) x^ny^m$$ where $-\infty < x_0 < x_1 < \infty$,…
a06e
  • 1,729
  • 15
  • 22
0
votes
0 answers

Integration of a discretized field in a cylindrical coordinate system

I would like to integrate a discretized field in cylindrical coordinates, given as A(r, z), with z being spaced regularly (spacing distance dz), and r being spaced non-regularly. Moreover, r[0]>0 due to the chosen discretization. For integration, I…
arc_lupus
  • 543
  • 4
  • 17
0
votes
0 answers

Does order of data points matter for approximating AUC with unit time steps?

I have a time series of data where the increment is every minute. In order to approximate AUC, I just compute the sum of the data values, since they would all be multiplied by 1 anyway per Riemann sum approximation of the integral. I'm fairly…
pyhat32