keisoku

DE (Double Exponential) Integration over (−∞, ∞)

Numerically integrate ∫f(x)dx over the whole real line with the double exponential (DE) transform. Just enter f(x) and the number of nodes.

Input

Numerically evaluate the definite integral ∫f(x)dx over (−∞, ∞) using the DE (double exponential) formula. Enter the integrand and the number of nodes.

e.g. exp(-x^2), 1/(1+x^2), exp(-x^2)*cos(x). Supports x, pi, e and sin/cos/exp/log/sqrt, etc.

Total samples are 2N+1 (5 to 5000).

Result

Integral ∫f(x)dx

1.7724538509

Total nodes

401

Half nodes N

200

Step h

0.02

Computation details

Integrandexp(-x^2)
Total nodes401
Step h0.02
Effective nodes165
Max reach |x|24.605

How it works

  • Integrates ∫f(x)dx over (−∞, ∞) by applying the double exponential (DE) change of variables x = sinh((π/2)·sinh t), mapping the infinite interval to a finite one summed with the equally spaced trapezoidal rule.
  • The Jacobian dx/dt = (π/2)·cosh(t)·cosh((π/2)·sinh t) is used as the quadrature weight, sampling at grid points t_k = k·h for k = −N…N.
  • This transform makes the integrand decay doubly exponentially toward the endpoints, so it converges rapidly with relatively few nodes even on an unbounded domain.
  • The integrand is parsed by a custom recursive descent parser (no eval). It supports + − * / ^, parentheses, unary minus, implicit multiplication, the variable x, the constants pi and e, and the functions sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, exp, log, ln, log10, sqrt, cbrt and abs.
  • Computation uses double precision floating point, so accuracy is highest when the integrand decays quickly at both tails. Slowly decaying or strongly oscillatory integrands may retain some error.

Reviews

Tell us what you think of this calculator.

Write a review

  1. Home
  2. DE (Double Exponential) Integration over (−∞, ∞)