10.3.3 Approximating computation of integrals: romberg nInt
The romberg command finds approximate values of integrals
using the Romberg method.
nInt is a synonym for rombert.
-
romberg takes three mandatory arguments and one
optional argument:
-
expr, an expression involving one variable.
- Optionally, var, the variable (by default
x).
- a,b, two real numbers.
- romberg(expr ⟨,var⟩ a,b)
returns an approximated value of the integral
∫abexprdvar. The integrand must be
sufficiently regular for the approximation to be accurate,
otherwise, romberg returns a list of real values that
come 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-MacLaurin formula to remove successive
even powers of the step of the trapezoid rule).
Example.
Input:
romberg(exp(x^2),x,0,1)
Output: