1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.hipparchus.distribution.continuous;
23
24 import org.hipparchus.util.Precision;
25 import org.junit.Assert;
26 import org.junit.Test;
27
28 public class LevyDistributionTest extends RealDistributionAbstractTest {
29
30 @Test
31 public void testParameters() {
32 LevyDistribution d = makeDistribution();
33 Assert.assertEquals(1.2, d.getLocation(), Precision.EPSILON);
34 Assert.assertEquals(0.4, d.getScale(), Precision.EPSILON);
35 }
36
37 @Test
38 public void testSupport() {
39 LevyDistribution d = makeDistribution();
40 Assert.assertEquals(d.getLocation(), d.getSupportLowerBound(), Precision.EPSILON);
41 Assert.assertTrue(Double.isInfinite(d.getSupportUpperBound()));
42 Assert.assertTrue(d.isSupportConnected());
43 }
44
45 @Override
46 public LevyDistribution makeDistribution() {
47 return new LevyDistribution(1.2, 0.4);
48 }
49
50 @Override
51 public double[] makeCumulativeTestPoints() {
52 return new double[] {
53 1.2001, 1.21, 1.225, 1.25, 1.3, 1.9, 3.4, 5.6
54 };
55 }
56
57 @Override
58 public double[] makeCumulativeTestValues() {
59
60 return new double[] {
61 0, 2.53962850749e-10, 6.33424836662e-05, 0.00467773498105,
62 0.0455002638964, 0.449691797969, 0.669815357599, 0.763024600553
63 };
64 }
65
66 @Override
67 public double[] makeDensityTestValues() {
68
69 return new double[] {
70 0, 5.20056373765e-07, 0.0214128361224, 0.413339707082, 1.07981933026,
71 0.323749319161, 0.0706032550094, 0.026122839884
72 };
73 }
74
75
76
77
78
79 @Override
80 public double[] makeLogDensityTestValues() {
81 return new double[] {
82 -1987.561573341398d, -14.469328620160d, -3.843764717971d,
83 -0.883485488811d, 0.076793740349d, -1.127785768948d,
84 -2.650679030597d, -3.644945255983d};
85 }
86 }