MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / testZeta

Method testZeta

JSAT/test/jsat/math/SpecialMathTest.java:47–102  ·  view source on GitHub ↗

Test of digamma method, of class SpecialMath.

()

Source from the content-addressed store, hash-verified

45 * Test of digamma method, of class SpecialMath.
46 */
47 @Test
48 public void testZeta()
49 {
50 System.out.println("digamma");
51
52 //Values in this range have crappy accuracy... sad panda
53
54 double[] inputNW = new double[]
55 {
56 -10.5, -2, -1.5,
57 };
58
59 double[] expectedNW = new double[]
60 {
61 0.01114612247394282,0.,-0.02548520188983304,
62 };
63
64 for(int i = 0; i < inputNW.length; i++)
65 {
66 assertEquals(expectedNW[i], SpecialMath.zeta(inputNW[i]), 1e-01);
67 }
68
69 //Decent
70 double[] input = new double[]
71 {
72 -0.5, 0.2, 0.5, 0.9, 1.1, 1.3, 2,
73 };
74 double[] expected = new double[]
75 {
76 -0.2078862249773546,-0.7339209248963376,-1.460354508809586,
77 -9.43011401940225,10.5844484649508,3.931949211809544,
78 1.644934066848226
79 };
80
81
82 for(int i = 0; i < input.length; i++)
83 {
84 assertEquals(expected[i], SpecialMath.zeta(input[i]), 1e-5);
85 }
86
87
88 //Very good
89 double[] inputVG = new double[]
90 {
91 2.6, 10.4, 15, 20, 40.0, 60
92 };
93 double[] expectedVG = new double[]
94 {
95 1.305477809072781,1.000751620674465,1.000030588236307,
96 1.000000953962033,1.00000000000091,0.999999999999997
97 };
98 for(int i = 0; i < expectedVG.length; i++)
99 {
100 assertEquals(expectedVG[i], SpecialMath.zeta(inputVG[i]), 1e-14);
101 }
102 }
103
104 /**

Callers

nothing calls this directly

Calls 1

zetaMethod · 0.95

Tested by

no test coverage detected