Exemplo n.º 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)
Exemplo n.º 2
0
    def test_calc_accuracy_central_deriv2_acc2(self):
        coefs = calc_coefs(2, [-1, 0, 1])

        self.assertEqual(2, coefs["accuracy"])
Exemplo n.º 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])
Exemplo n.º 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])
Exemplo n.º 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"])
Exemplo n.º 6
0
    def test_calc_accuracy_left0_right3_deriv1_acc3(self):
        coefs = calc_coefs(2, [0, 1, 2, 3])

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

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