The net.sf.doodleproject.numerics4j.integration.AdaptiveIntegrator class provides an implementation of Adaptive Quadrature.
Evaluating definite integrals using adaptive quadrature involves
creating a AdaptiveIntegrator object for a particular
net.sf.doodleproject.numerics4j.function.Function
object. Once, the integrator is created, definite integrals can be
evaluated by calling the integrate method providing the
limits of integration. Here is an example of evaluating integrals for
sine:
Function sine = new Function() {
public double evaluate(double x) {
return Math.sin(x);
}
};
AdaptiveIntegrator integrator = new AdaptiveIntegrator(sine);
// integrate sine from 0 to Pi.
double two = integrator.integrate(0.0, Math.PI);
// integrate sine from Pi/2 to 2 Pi.
double one = integrator.integrate(Math.PI / 2.0, Math.PI);