Numerical integrator

Enter a function and domain to compute a numerical approximation to the corresponding definite integral along with a graph representing the integral.

$f(x)$: $a$: $b$:

$\displaystyle \int_a^b f(x) \, dx \approx$ ?

See what Wolfram|Alpha has to say

Notes

This page demonstrates a simple numerical integrator implemented in Javascript. It's not meant to be production quality, rather it provides an easy to use tool for folks who are just learning about numerical integration. It also provides a link to the same computation performed by Wolfram|Alpha, which (I guess) is supposed to be production quality. In addition, there is a graph that is produced immediately which provides some rough verification. That graph is not always perfect but, then, neither is numerical integration.

Credits

The input mathematical expressions are parsed using math.js.

Some numerical computations, including the integral itself, are performed by numeric.js. Strictly speaking, numeric.js does not (directly) provide a numeric integration routine. It does, however, have a fairly general ODE solver using the Dormand-Prince method or DOPRI. Thus, the integrator works by solving the ODE $y'=f(x)$ with initial condition $y(a)=0$ and then evaluating the result at $x=b$.

The graph is produced by D3 and basic DOM manipulation is provided by jQuery.