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

Method test_hermeder

numpy/polynomial/tests/test_hermite_e.py:329–353  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

327class TestDerivative:
328
329 def test_hermeder(self):
330 # check exceptions
331 assert_raises(TypeError, herme.hermeder, [0], .5)
332 assert_raises(ValueError, herme.hermeder, [0], -1)
333
334 # check that zeroth derivative does nothing
335 for i in range(5):
336 tgt = [0] * i + [1]
337 res = herme.hermeder(tgt, m=0)
338 assert_equal(trim(res), trim(tgt))
339
340 # check that derivation is the inverse of integration
341 for i in range(5):
342 for j in range(2, 5):
343 tgt = [0] * i + [1]
344 res = herme.hermeder(herme.hermeint(tgt, m=j), m=j)
345 assert_almost_equal(trim(res), trim(tgt))
346
347 # check derivation with scaling
348 for i in range(5):
349 for j in range(2, 5):
350 tgt = [0] * i + [1]
351 res = herme.hermeder(
352 herme.hermeint(tgt, m=j, scl=2), m=j, scl=.5)
353 assert_almost_equal(trim(res), trim(tgt))
354
355 def test_hermeder_axis(self):
356 # 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