keisoku

Double Exponential (DE / tanh-sinh) Numerical Integration over a Finite Interval

Enter a function f(x) and an interval [a, b] to compute the definite integral ∫f(x)dx over a finite interval with high accuracy using the double exponential (DE / tanh-sinh) quadrature, which handles endpoint singularities well.

Input

Enter the integrand f(x), the interval [a, b], and a refinement level to compute the definite integral ∫f(x)dx using the double exponential (DE / tanh-sinh) rule.

e.g. exp(-x^2), sin(x)/x, 1/sqrt(x). Use the variable x, constants pi and e, and functions like sin, cos, exp, log, sqrt.

Refinement level

Higher = more accurate

Result

Integral ∫f(x)dx

0.7468241328

Computation details

Interval [a, b][0, 1]
Refinement level8
Function evaluations1,537
Step size h0.0078125
Estimated error1.44e-15

How it works

  • Uses the change of variables x = (b+a)/2 + (b−a)/2·tanh((π/2)·sinh t), reducing the integral to a trapezoidal sum over the infinite line t∈(−∞,∞): the double exponential (DE / tanh-sinh) rule.
  • The weight dx/dt = (b−a)/2·(π/2)·cosh t / cosh²((π/2)·sinh t) decays double-exponentially as |t| grows, so the sum can be truncated to finitely many nodes.
  • Because the integrand's contribution decays rapidly near the endpoints a and b, the method tends to converge stably even for integrals that are singular (divergent) at an endpoint.
  • Increasing the refinement level halves the step size h and adds more nodes, improving accuracy. The reported error estimate is the absolute difference from the previous level.
  • Expressions are parsed by a custom recursive-descent parser without 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 abs.
  • Results are computed in double precision and shown to up to 10 digits. Depending on the integrand and interval, some error versus the exact value may remain, so treat the output as a reference value.

Reviews

Tell us what you think of this calculator.

Write a review

  1. Home
  2. Double Exponential (DE / tanh-sinh) Numerical Integration over a Finite Interval