MCPcopy Create free account
hub / github.com/numpy/numpy / test_deriv

Function test_deriv

numpy/polynomial/tests/test_classes.py:459–474  ·  view source on GitHub ↗
(Poly)

Source from the content-addressed store, hash-verified

457
458
459def test_deriv(Poly):
460 # Check that the derivative is the inverse of integration. It is
461 # assumes that the integration has been checked elsewhere.
462 d = Poly.domain + random((2,))*.25
463 w = Poly.window + random((2,))*.25
464 p1 = Poly([1, 2, 3], domain=d, window=w)
465 p2 = p1.integ(2, k=[1, 2])
466 p3 = p1.integ(1, k=[1])
467 assert_almost_equal(p2.deriv(1).coef, p3.coef)
468 assert_almost_equal(p2.deriv(2).coef, p1.coef)
469 # default domain and window
470 p1 = Poly([1, 2, 3])
471 p2 = p1.integ(2, k=[1, 2])
472 p3 = p1.integ(1, k=[1])
473 assert_almost_equal(p2.deriv(1).coef, p3.coef)
474 assert_almost_equal(p2.deriv(2).coef, p1.coef)
475
476
477def test_linspace(Poly):

Callers

nothing calls this directly

Calls 4

assert_almost_equalFunction · 0.90
PolyFunction · 0.85
integMethod · 0.45
derivMethod · 0.45

Tested by

no test coverage detected