/** * 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. */ 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; }