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

Method test_legder

numpy/polynomial/tests/test_legendre.py:314–337  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

312class TestDerivative:
313
314 def test_legder(self):
315 # check exceptions
316 assert_raises(TypeError, leg.legder, [0], .5)
317 assert_raises(ValueError, leg.legder, [0], -1)
318
319 # check that zeroth derivative does nothing
320 for i in range(5):
321 tgt = [0]*i + [1]
322 res = leg.legder(tgt, m=0)
323 assert_equal(trim(res), trim(tgt))
324
325 # check that derivation is the inverse of integration
326 for i in range(5):
327 for j in range(2, 5):
328 tgt = [0]*i + [1]
329 res = leg.legder(leg.legint(tgt, m=j), m=j)
330 assert_almost_equal(trim(res), trim(tgt))
331
332 # check derivation with scaling
333 for i in range(5):
334 for j in range(2, 5):
335 tgt = [0]*i + [1]
336 res = leg.legder(leg.legint(tgt, m=j, scl=2), m=j, scl=.5)
337 assert_almost_equal(trim(res), trim(tgt))
338
339 def test_legder_axis(self):
340 # 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