#include <adaptive.h>

Public Member Functions | |
| adaptive_integrator (Function &f, unsigned int iterations=100, double relative_error=1.0e-15) | |
| ~adaptive_integrator () | |
| double | integrate (double a, double b) |
For example, to evaluate definite integrals for sine, first a Simpson's integrator is created providing a target function functor:
typdef double Function(double);
num::adpative_integrator<Function> integrator(std::sin);
Then, evaluating definite integrals is accomplished using the integrate method:
// integrate sine from 0 to Pi.
double two = integrator.integrate(0.0, num::PI);
integrate sine from Pi/2 to 2 Pi. double one = integrator.integrate(num::PI / 2.0, num::PI);
References:
| adaptive_integrator< Function >::adaptive_integrator | ( | Function & | f, | |
| unsigned int | iterations = 100, |
|||
| double | relative_error = 1.0e-15 | |||
| ) | [inline] |
Create an integrator for the given function.
| f | the function functor. | |
| iterations | the maximum number of iterations. | |
| relative_error | the maximum allowable relative error. |
| adaptive_integrator< Function >::~adaptive_integrator | ( | ) | [inline] |
Destructor.
| double adaptive_integrator< Function >::integrate | ( | double | a, | |
| double | b | |||
| ) | [inline] |
Evaluate the definite integral from a to b.
| a | the lower limit of integration. | |
| b | the upper limit of integration. |
a to b.
1.5.3