Previous Up Next

4.3.3  Approximate computation of integrals : romberg nInt

romberg or nInt takes as arguments : an expression ex, the variable name of this expression (by default x), and two real values a,b.
romberg(ex,x,a,b) or nInt(ex,x,a,b) computes an approximated value of the integral ∫ab ex dx using the Romberg method. The integrand must be sufficiently regular for the approximation to be accurate. Otherwise, romberg returns a list of real values, that comes from the application of the Romberg algorithm (the first list element is the trapezoid rule approximation, the next ones come from the application of the Euler-Mac Laurin formula to remove successive even powers of the step of the trapezoid rule).
Input :

romberg(exp(x^2),x,0,1)

Output :

1.46265174591

Previous Up Next