What this calculator does
This tool numerically evaluates the definite integral of a function f(x) over the entire real line, from minus infinity to plus infinity, using Double-Exponential (DE) quadrature — also called the tanh-sinh family or the Takahasi-Mori method. DE quadrature is one of the most efficient general-purpose schemes for smooth integrands and converges astonishingly fast: the number of correct digits grows nearly linearly with the number of sample points.
How to use it
Type a math expression for f(x) using x, the operators + - * / ^, parentheses, and standard functions such as exp, log/ln, sin, cos, tan, sqrt, abs and atan. Then choose how many significant digits you want (6 to 50). Higher precision uses a finer step size and a wider truncation range. The integrand should be analytic on the real line and must decay as x grows; it must not be periodic or oscillate without decaying.
The formula explained
The DE method applies the change of variable \(x = \sinh\!\left(\tfrac{\pi}{2}\sinh t\right)\), whose derivative is \(\varphi'(t) = \tfrac{\pi}{2}\cosh t\,\cosh\!\left(\tfrac{\pi}{2}\sinh t\right)\). After substitution the integral becomes the integral of \(f(\varphi(t))\,\varphi'(t)\) in t. Because \(\varphi'(t)\) decays like a double exponential as |t| grows, the simple trapezoidal rule with uniform step h, $$I \approx h \cdot \sum f(\varphi(kh))\,\varphi'(kh),$$ becomes extremely accurate. The calculator starts with a coarse step, then halves h repeatedly (reusing nodes) until two successive estimates agree to the requested tolerance.
Worked example
For \(f(x) = \tfrac{1}{1+x^2}\) the exact integral is \([\arctan x]\) from minus to plus infinity $$\int_{-\infty}^{\infty} \frac{1}{1+x^2}\,dx = \pi \approx 3.14159265358979.$$ A coarse DE sum with step 0.5 over nodes k = -8..8 already gives about 3.15; refining the step converges to the full-precision value of pi. Likewise \(\exp(-x^2)\) returns \(\sqrt{\pi} \approx 1.77245385090552\).
FAQ
Why does it say "did not converge"? Most often the integral diverges (the integrand does not decay, e.g. f = 1) or the function is periodic/oscillatory. DE quadrature assumes a non-periodic, endpoint-analytic integrand.
What precision should I pick? 15 digits matches double precision and is a good default. Asking for far more digits than double precision can support will not improve the answer.
Can I integrate singular functions? The method tolerates endpoint behavior because extreme nodes are weighted to nearly zero, but interior poles on the real axis will break it.