List of usage examples for org.apache.commons.math3.analysis.integration RombergIntegrator RombergIntegrator
public RombergIntegrator(final int minimalIterationCount, final int maximalIterationCount) throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException
From source file:com.github.rinde.rinsim.scenario.generator.IntensityFunctions.java
/** * Compute the area of a sine intensity by using numerical approximation. The * range for which the area is computed is defined by a lower bound of * <code>0</code> and an upper bound of <code>length</code>. * @param s The intensity function to integrate. * @param lb The lower bound of the range. * @param ub The upper bound of the range. * @return The area./* w ww .java2 s . c o m*/ */ public static double areaByIntegration(IntensityFunction s, double lb, double ub) { final UnivariateIntegrator ri = new RombergIntegrator(16, 32); final double val = ri.integrate(10000000, asUnivariateFunction(s), lb, ub); return val; }