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

Method test_hermder

numpy/polynomial/tests/test_hermite.py:310–333  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

308class TestDerivative:
309
310 def test_hermder(self):
311 # check exceptions
312 assert_raises(TypeError, herm.hermder, [0], .5)
313 assert_raises(ValueError, herm.hermder, [0], -1)
314
315 # check that zeroth derivative does nothing
316 for i in range(5):
317 tgt = [0]*i + [1]
318 res = herm.hermder(tgt, m=0)
319 assert_equal(trim(res), trim(tgt))
320
321 # check that derivation is the inverse of integration
322 for i in range(5):
323 for j in range(2, 5):
324 tgt = [0]*i + [1]
325 res = herm.hermder(herm.hermint(tgt, m=j), m=j)
326 assert_almost_equal(trim(res), trim(tgt))
327
328 # check derivation with scaling
329 for i in range(5):
330 for j in range(2, 5):
331 tgt = [0]*i + [1]
332 res = herm.hermder(herm.hermint(tgt, m=j, scl=2), m=j, scl=.5)
333 assert_almost_equal(trim(res), trim(tgt))
334
335 def test_hermder_axis(self):
336 # check that axis keyword works

Callers

nothing calls this directly

Calls 4

assert_raisesFunction · 0.90
assert_equalFunction · 0.90
assert_almost_equalFunction · 0.90
trimFunction · 0.70

Tested by

no test coverage detected