next up previous contents
Next: Integral in several variables Up: Integration Previous: Integration   Contents

Integral in one variable

The basic integration procedure is Integrate(Func , Init) where Func is the integrand and Init the range for the integration. For example

 
Integrate(1/x,[1,2]);
returns the range [.69264842756679057, .69364643155883843] if `ALIAS/fepsilon` is set to 1e-3. This procedure should not be used to determine accurate range.

For accurate computation for function that are at least twice differentiable you may use IntegrateTrapeze or IntegrateRectangle which have the same syntax than Integrate. You may also use IntegrateTaylor that use a Taylor expansion of order N of the function. The syntax is

 
IntegrateTaylor(Func,Init,N)

All these procedures will return UNABLE if the integral cannot be computed with the desired accuracy or FAILED if the number of boxes exceed the global variable `ALIAS/maxbox`. As the default value of this variable is 20 000 (i.e. relatively small) it may be necessary to set the variable to a larger number before calculating the integral.

Note that the derivatives of the function and the function itself may involve expression that cannot be interval evaluated everywhere. Hence it is of good policy to check this point by using the Problem_Expression package and that may require to set some parameters of this package (see section 2.1.5).

For example assume that we have to integrate the function $\sqrt{1-\cos^2(x)}$ in the range 0, $\pi/2$. The derivatives of this expression involves the expression of $1/(\sqrt{1-\cos^2(x)})$ which is not defined in 0. If we use IntegrateTaylor of order 2 we need to ensure that the function and the derivatives up to the third one can be interval evaluated.

 
eq:=sqrt(1-cos(x)^2):
`ALIAS/close_to_zero`:=1e-20:
`ALIAS/low_value_expr_violated`:=1:
`ALIAS/high_value_expr_violated`:=1:
Verify_Problem_Expression([eq,diff(eq,x\$1),diff(eq,x\$2),diff(eq,x\$3)],[x]):
IntegrateTaylor(eq,[0,evalf(Pi)/2.],2);
The setting of the parameters allows to calculate the integral.


next up previous contents
Next: Integral in several variables Up: Integration Previous: Integration   Contents
Jean-Pierre Merlet 2012-12-20