def test_calc_coefs_symbolic(self): coefs = calc_coefs(1, [-2, 0, 1], symbolic=True) expected = [Rational(-1, 6), Rational(-1, 2), Rational(2, 3)] np.testing.assert_array_almost_equal(coefs["coefficients"], expected)
def test_calc_accuracy_central_deriv2_acc2(self): coefs = calc_coefs(2, [-1, 0, 1]) self.assertEqual(2, coefs["accuracy"])
def test_calc_coefs_from_offsets_no_central_point(self): coefs = calc_coefs(1, [-2, 1, 2]) np.testing.assert_array_almost_equal(coefs["coefficients"], [-1. / 4, 0, 1. / 4])
def test_calc_coefs_from_offsets(self): coefs = calc_coefs(1, [-2, 0, 1]) np.testing.assert_array_almost_equal(coefs["coefficients"], [-1. / 6, -0.5, 2. / 3])
def test_calc_accuracy_from_offsets_symbolic(self): coefs = calc_coefs(2, [0, 1, 2, 3], symbolic=True) self.assertEqual(2, coefs["accuracy"])
def test_calc_accuracy_left0_right3_deriv1_acc3(self): coefs = calc_coefs(2, [0, 1, 2, 3]) self.assertEqual(2, coefs["accuracy"])
def test_calc_accuracy_left1_right0_deriv1_acc1(self): coefs = calc_coefs(1, [-1, 0]) self.assertEqual(1, coefs["accuracy"])