Debian Codegraph @

src/test/dr/distibutions/BifractionalDiffusionDensityTest.java

raw symbols SCIP
1 package test.dr.distibutions;
2
3 import junit.framework.TestCase;
4 import dr.math.distributions.BifractionalDiffusionDensity;
5 import dr.math.distributions.NormalDistribution;
6
7 /**
8 * @author Marc A. Suchard
9 */
10 public class BifractionalDiffusionDensityTest extends TestCase {
11
12
13 public void setUp() {
14
15 // Do nothing
16 }
17
18 public void testBrownianPdf() {
19
20 System.out.println("Testing normal density");
21 double alpha = 2.0;
22 double beta = 1.0;
23 BifractionalDiffusionDensity density = new BifractionalDiffusionDensity(alpha, beta);
24
25 double vLower = 1.0;
26 double vUpper = 100.0;
27 double vIncr = 10.0;
28
29 double xLower = -5;
30 double xUpper = +5;
31 double xIncr = 1;
32
33 for (double v = vLower; v <= vUpper; v *= vIncr) {
34 for (double x = xLower; x <= xUpper; x += xIncr) {
35 double pdf = density.pdf(x, v);
36 double pdfCheck = NormalDistribution.pdf(x, 0, Math.sqrt(v));
37 System.err.println("A = "+pdf+ "(x = "+x+", v = "+v+")");
38 System.err.println("B = "+pdfCheck);
39 assertEquals(pdf, pdfCheck, 1E-10);
40 }
41 }
42
43
44
45 }
46
47
48
49 }