def test_derivative2_degree3_t0(self): np.random.seed(0) knots = np.linspace(0, 10, 8) t0 = .5 f = lambda t: spline.basis(t, 0, knots, degree=3) h_numeric = numdifftools.Derivative(f, 2)(t0) h_analytic = spline.basis_d2(t0, 0, knots, degree=3) self.assertAlmostEqual(h_numeric, h_analytic)
def test_derivative_degree3(self): np.random.seed(0) knots = np.linspace(0, 10, 8) t0 = 2. f = lambda t: spline.basis(t, 2, knots, degree=3) j_numeric = numdifftools.Derivative(f)(t0) j_analytic = spline.basis_d1(t0, 2, knots, degree=3) self.assertAlmostEqual(j_numeric, j_analytic)