RombergIntegration

Prototype

Matrix RombergIntegration( Matrix FunctionName, Matrix a, Matrix b, Matrix MaxIters )

Return Value

The return value is a scalar that approximates the value of a definite integral of a continuous function over a finite interval.

Parameters

Matrix FunctionName
The name of a module that defines the function to integrate.

Matrix a
A scalar value representing the left-hand endpoint of the domain of integration.

Matrix b
A scalar value representing the right-hand endpoint of the domain of integration.

Matrix MaxIters
A scalar value representing the maximum number of iterations for the Romberg integration algorithm.

Remarks

Romberg integration is a numerical integration method that uses extrapolation of trapezoidal sums to approximate an integral over a finite domain [a, b]. Roughly speaking, the algorithm computes a sequence of trapezoidal approximations with decreasing step sizes, and extrapolates the result to the limiting case of zero step size. Typically, six or seven step sizes are sufficient.

By default, the module tries to produce an answer that has absolute error less than 1e-8 of the true value of the integral. To modify this criterion, define the global variable __ConvergenceCriterion with a new value. For example, if you only need a numerical solution to within +/-1 of the true value of the integral, then define __ConvergenceCriterion=1 before calling the module.

Example
start cot4( x );
    return ((cos(x)/sin(x))##4 ); /* cot^4(x) */
finish;

Pi = 4*atan( 1 );
approxIntegral = RombergIntegration( "cot4", Pi/4, 3*Pi/4, 6 );
exactIntegral = Pi/2 - 4/3;
print approxIntegral exactIntegral;