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
29
30
31 public class NakagamiDistributionTest extends RealDistributionAbstractTest {
32
33 @Test
34 public void testParameters() {
35 NakagamiDistribution d = makeDistribution();
36 Assert.assertEquals(0.5, d.getShape(), Precision.EPSILON);
37 Assert.assertEquals(1, d.getScale(), Precision.EPSILON);
38 }
39
40 @Test
41 public void testSupport() {
42 NakagamiDistribution d = makeDistribution();
43 Assert.assertEquals(d.getSupportLowerBound(), 0, Precision.EPSILON);
44 Assert.assertTrue(Double.isInfinite(d.getSupportUpperBound()));
45 Assert.assertTrue(d.isSupportConnected());
46 }
47
48 @Override
49 public NakagamiDistribution makeDistribution() {
50 return new NakagamiDistribution(0.5, 1);
51 }
52
53 @Override
54 public double[] makeCumulativeTestPoints() {
55 return new double[] {
56 0, 0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2
57 };
58 }
59
60 @Override
61 public double[] makeDensityTestValues() {
62 return new double[] {
63 0.0000000, 0.7820854, 0.7365403, 0.6664492, 0.5793831, 0.4839414,
64 0.3883721, 0.2994549, 0.2218417, 0.1579003, 0.1079819
65 };
66 }
67
68 @Override
69 public double[] makeCumulativeTestValues() {
70 return new double[] {
71 0.0000000, 0.1585194, 0.3108435, 0.4514938, 0.5762892, 0.6826895,
72 0.7698607, 0.8384867, 0.8904014, 0.9281394, 0.9544997
73 };
74 }
75
76 }
77