interpolator.addSamplePoint(new BigFraction(0), new BigFraction[] { new BigFraction(2) });
interpolator.addSamplePoint(new BigFraction(1), new BigFraction[] { new BigFraction(0) });
interpolator.addSamplePoint(new BigFraction(2), new BigFraction[] { new BigFraction(0) });
for (double x = -10; x < 10; x += 1.0) {
BigFraction y = interpolator.value(new BigFraction(x))[0];
Assert.assertEquals((x - 1) * (x - 2), y.doubleValue(), 1.0e-15);
BigFraction[][] derivatives = interpolator.derivatives(new BigFraction(x), 3);
Assert.assertEquals((x - 1) * (x - 2), derivatives[0][0].doubleValue(), 1.0e-15);
Assert.assertEquals(2 * x - 3, derivatives[1][0].doubleValue(), 1.0e-15);
Assert.assertEquals(2, derivatives[2][0].doubleValue(), 1.0e-15);
Assert.assertEquals(0, derivatives[3][0].doubleValue(), 1.0e-15);