keisoku

Tanh-Sinh Quadrature (Double Exponential) Integral Calculator

Enter f(x) and an interval [a,b] to compute the definite integral with tanh-sinh (double exponential) quadrature—robust even for endpoint singularities.

Input

Enter the integrand f(x), the interval [a, b], and a level to compute the definite integral with tanh-sinh (double exponential) quadrature.

e.g. exp(-x^2), sin(x), 1/sqrt(x). Variable x, constants pi/e, functions sin/cos/exp/log/sqrt, etc. Implicit multiplication (2x) is allowed.

Higher levels add more nodes and increase accuracy. A level around 8 is usually enough.

Result

Integral value

0.7468241328

Nodes used

127

Level reached

6

Estimated error

1.11e-16

How it works

  • Tanh-sinh (double exponential, DE) quadrature evaluates the definite integral ∫f(x)dx on a finite interval [a,b] using the change of variables x=(a+b)/2+(b-a)/2·tanh(π/2·sinh(t)).
  • After the substitution the integrand decays double-exponentially as t→±∞, so applying the trapezoidal rule with a uniform step h already yields very high accuracy. The weight dx/dt=(b-a)/2·(π/2)·cosh(t)/cosh(π/2·sinh(t))^2 is folded into each sample.
  • Each additional level halves the step size h and reuses existing nodes, adding only the new odd-indexed nodes. This raises accuracy progressively while keeping the number of function evaluations low.
  • Because the transformed nodes approach the endpoints x=a and x=b with rapidly vanishing weights, integrands that diverge at an endpoint—such as 1/√x or log(x)—can be integrated stably without evaluating the function at the singularity itself.
  • The estimated error shown is the absolute difference from the previous level's approximation. The true error is often smaller; use this value as a convergence indicator.
  • Expressions are parsed by an in-house recursive-descent parser supporting + - * / ^, parentheses, unary minus, implicit multiplication (e.g. 2x, x sin(x)), the variable x, the constants pi and e, and the functions sin cos tan asin acos atan sinh cosh tanh exp log(=ln) ln log10 sqrt cbrt abs.
  • For extremely wide intervals, or integrands with interior singularities or heavy oscillation, the assumptions behind the transformation may break down and accuracy can degrade. This tool is intended for estimation and learning.

Reviews

Tell us what you think of this calculator.

Write a review

  1. Home
  2. Tanh-Sinh Quadrature (Double Exponential) Integral Calculator