1 /* 2 * ErfTest Class 3 */ 4 5 package org.lcsim.math.probability; 6 7 import junit.framework.TestCase; 8 9 /** 10 * Test case for Erf methods 11 * 12 * @author partridge 13 */ 14 public class ErfTest extends TestCase { 15 16 public void testErf() { 17 18 // Value of erf(1) from Abramowitz and Steigun 19 double erf1 = 0.8427007929; 20 double root2 = Math.sqrt(2.); 21 assertEquals("Erf", erf1, Erf.erf(1.), 1e-10); 22 assertEquals("Erfc", 1. - erf1, Erf.erfc(1.), 1e-10); 23 assertEquals("Phi", 0.5 * (1. + erf1), Erf.phi(root2), 1e-10); 24 assertEquals("PhiC", 0.5 * (1. - erf1), Erf.phic(root2), 1e-10); 25 } 26 }