Beispiel #1
0
 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)
Beispiel #2
0
    def test_calc_accuracy_central_deriv2_acc2(self):
        coefs = calc_coefs(2, [-1, 0, 1])

        self.assertEqual(2, coefs["accuracy"])
Beispiel #3
0
 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])
Beispiel #4
0
 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])
Beispiel #5
0
    def test_calc_accuracy_from_offsets_symbolic(self):
        coefs = calc_coefs(2, [0, 1, 2, 3], symbolic=True)

        self.assertEqual(2, coefs["accuracy"])
Beispiel #6
0
    def test_calc_accuracy_left0_right3_deriv1_acc3(self):
        coefs = calc_coefs(2, [0, 1, 2, 3])

        self.assertEqual(2, coefs["accuracy"])
Beispiel #7
0
    def test_calc_accuracy_left1_right0_deriv1_acc1(self):
        coefs = calc_coefs(1, [-1, 0])

        self.assertEqual(1, coefs["accuracy"])