Contents Previous Next Subchapters

Numerical Integration to Infinity
Syntax int2inf(function fvecloweps)
See Also gaussq , gaussleg

Returns an approximation for
     | f(xdx
where low is a real or double-precision scalar. Given a column vector xvec of length n and with the same type as low, the function fvec returns the column vector
     /          \
     | f(xvec ) |
     |       1  |
     | f(xvec ) |
     |       2  |
     |    ...   |
     | f(xvec ) |
     \       n  /
The relative accuracy for the integral is specified by eps which is a scalar with the same type as low . If the approximation converges, the return value is a scalar with the same type as low. Otherwise, the return value has type equal to "novalue".

If you enter
     function fvec(xvec) begin
          return exp(-xvec)
     low  = 0.
     eps  = 1e-5
     int2inf(function fvec, low, eps)
O-Matrix will reply
which is equal to the integral of exp(-x) from zero to infinity.

This integration method assumes that
     f(x)  x  -->  0  as x --> +infinity