# Numerical integration

The integral can be calculated exactly. Its value is . However, integrals of the form can in general not be determined exactly.

There are different commands to approximate an integral numerically. Also refer to the help facilities. We will use the command quad (which is an abbreviation of quadrature) and let the result appear with 15 digits.
>> format long

ans =
6.02456548407172

It is not possible to use f(x)' as the first argument. The approximation already differs from the exact value above after the fifth digit. In principle, quad tries to give the first four decimal points correctly. The precision of the approximation can be improved by using some extra input arguments. Refer to the help facilities to find out the meaning of these extra input arguments.
>> quad('f',-2,3,[10^-7 10^-7])

ans =
6.02453446058438
`

Esteur 2010-03-22