Function intde
I = integral of f(x) over (a,b)
void intde(Real, Func)
(
Func f,
Real a,
Real b,
Real* aw,
Real* i,
Real* err
);
Examples
auto aw = new real[8000];
intdeini(aw .length, tiny, eps, aw .ptr); // initialization of aw
...
intde(f, a, b, aw .ptr, &i, &err);
Parameters
Name | Description |
---|---|
lenaw | length of aw |
tiny | minimum value that 1/tiny does not overflow |
eps | relative error requested |
aw | points and weights of the quadrature formula, aw[0...lenaw-1] |
f | integrand f(x) |
a | lower limit of integration |
b | upper limit of integration |
i | approximation to the integral |
err | estimate of the absolute error |
Remarks
initial parameters lenaw > 1000, IEEE double : lenaw = 8000; tiny = 1.0e-307; function f(x) needs to be analytic over (a,b). relative error eps is relative error requested excluding cancellation of significant digits. i.e. eps means : (absolute error) / (integral_a^b |f(x)| dx). eps does not mean : (absolute error) / I. error message err >= 0 : normal termination. err < 0 : abnormal termination. i.e. convergent error is detected : 1. f(x) or (d/dx)^n f(x) has discontinuous points or sharp peaks over (a,b). you must divide the interval (a,b) at this points. 2. relative error of f(x) is greater than eps. 3. f(x) has oscillatory factor and frequency of the oscillation is very high.