*/
@Test
public void testDensityIntegrals() {
final double tol = 1.0e-9;
final BaseAbstractUnivariateIntegrator integrator =
new IterativeLegendreGaussIntegrator(5, 1.0e-12, 1.0e-10);
final UnivariateFunction d = new UnivariateFunction() {
public double value(double x) {
return distribution.density(x);
}
};
final ArrayList<Double> integrationTestPoints = new ArrayList<Double>();
for (int i = 0; i < cumulativeTestPoints.length; i++) {
if (Double.isNaN(cumulativeTestValues[i]) ||
cumulativeTestValues[i] < 1.0e-5 ||
cumulativeTestValues[i] > 1 - 1.0e-5) {
continue; // exclude integrals outside domain.
}
integrationTestPoints.add(cumulativeTestPoints[i]);
}
Collections.sort(integrationTestPoints);
for (int i = 1; i < integrationTestPoints.size(); i++) {
Assert.assertEquals(
distribution.cumulativeProbability( // FIXME @4.0 when rename happens
integrationTestPoints.get(0), integrationTestPoints.get(i)),
integrator.integrate(
1000000, // Triangle integrals are very slow to converge
d, integrationTestPoints.get(0),
integrationTestPoints.get(i)), tol);
}
}