~ubuntu-branches/ubuntu/oneiric/commons-math/oneiric

« back to all changes in this revision

Viewing changes to src/test/java/org/apache/commons/math/distribution/PoissonDistributionTest.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan, Torsten Werner, Damien Raude-Morvan
  • Date: 2011-03-07 21:14:46 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110307211446-4zea7og4eeyzhpai
Tags: 2.2-1
[ Torsten Werner ]
* Change maintainers into Maintainers.

[ Damien Raude-Morvan ]
* New upstream release (Closes: #617209).
* d/control: Bump Standards-Version to 3.9.1 (no changes needed).
* d/copyright: Refresh years, upgrade to DEP5 r166 and relicence my work
  under Apache-2.0.
* d/ant.properties: Set junit.jar to /usr/share/java/junit4.jar
  to ensure unit tests are launched.
* d/docs: Install upstream RELEASE-NOTES.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
package org.apache.commons.math.distribution;
18
18
 
19
19
import org.apache.commons.math.MathException;
 
20
import org.apache.commons.math.util.FastMath;
20
21
 
21
22
/**
22
23
 * <code>PoissonDistributionTest</code>
23
24
 *
24
 
 * @version $Revision: 924345 $ $Date: 2010-03-17 12:03:56 -0400 (Wed, 17 Mar 2010) $
 
25
 * @version $Revision: 1054524 $ $Date: 2011-01-03 05:59:18 +0100 (lun. 03 janv. 2011) $
25
26
 */
26
27
public class PoissonDistributionTest extends IntegerDistributionAbstractTest {
27
28
 
152
153
            double x = mean * 2.0;
153
154
            double dx = x / 10.0;
154
155
            double p = Double.NaN;
155
 
            double sigma = Math.sqrt(mean);
 
156
            double sigma = FastMath.sqrt(mean);
156
157
            while (x >= 0) {
157
158
                try {
158
159
                    p = dist.cumulativeProbability(x);
216
217
            mean *= 10.0;
217
218
        }
218
219
    }
 
220
 
 
221
    public void testMomonts() {
 
222
        final double tol = 1e-9;
 
223
        PoissonDistributionImpl dist;
 
224
        
 
225
        dist = new PoissonDistributionImpl(1);
 
226
        assertEquals(dist.getNumericalVariance(), 1, tol); 
 
227
        
 
228
        dist.setMean(11.23);
 
229
        assertEquals(dist.getNumericalVariance(), 11.23, tol);
 
230
    }
219
231
}