Astronomical { static double interpolate(double y2, double y1, double y3, double n) { final double a = y2 - y1; final double b = y3 - y2; final double c = b - a; return y2 + ((n/2) * (a + b + (n * c))); }    }
@Test public void testInterpolation() { final double interpolatedValue = Astronomical.interpolate( 0.877366, 0.884226, 0.870531, 4.35/24); assertThat(interpolatedValue).isWithin(0.000001).of(0.876125); final double i1 = Astronomical.interpolate( 1, -1, 3, 0.6); assertThat(i1).isWithin(0.000001).of(2.2); }