You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2013/06/28 22:06:05 UTC

svn commit: r1497904 - /commons/proper/math/trunk/src/test/java/org/apache/commons/math3/analysis/integration/IterativeLegendreGaussIntegratorTest.java

Author: erans
Date: Fri Jun 28 20:06:05 2013
New Revision: 1497904

URL: http://svn.apache.org/r1497904
Log:
MATH-995
Unit test.

Modified:
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/analysis/integration/IterativeLegendreGaussIntegratorTest.java

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/analysis/integration/IterativeLegendreGaussIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/analysis/integration/IterativeLegendreGaussIntegratorTest.java?rev=1497904&r1=1497903&r2=1497904&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/analysis/integration/IterativeLegendreGaussIntegratorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/analysis/integration/IterativeLegendreGaussIntegratorTest.java Fri Jun 28 20:06:05 2013
@@ -21,6 +21,7 @@ import java.util.Random;
 import org.apache.commons.math3.analysis.QuinticFunction;
 import org.apache.commons.math3.analysis.UnivariateFunction;
 import org.apache.commons.math3.analysis.function.Sin;
+import org.apache.commons.math3.analysis.function.Gaussian;
 import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
 import org.apache.commons.math3.exception.TooManyEvaluationsException;
 import org.apache.commons.math3.util.FastMath;
@@ -102,6 +103,24 @@ public class IterativeLegendreGaussInteg
         }
     }
 
+    // Cf. MATH-995
+    @Test
+    public void testNormalDistributionWithLargeSigma() {
+        final double sigma = 1000;
+        final double mean = 0;
+        final double factor = 1 / (sigma * FastMath.sqrt(2 * FastMath.PI));
+        final UnivariateFunction normal = new Gaussian(factor, mean, sigma);
+
+        final double tol = 1e-2;
+        final IterativeLegendreGaussIntegrator integrator =
+            new IterativeLegendreGaussIntegrator(5, tol, tol);
+
+        final double a = -5000;
+        final double b = 5000;
+        final double s = integrator.integrate(50, normal, a, b);
+        Assert.assertEquals(1, s, 1e-5);
+    }
+
     @Test
     public void testIssue464() {
         final double value = 0.2;