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

Method test_chebder

numpy/polynomial/tests/test_chebyshev.py:322–345  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

320class TestDerivative:
321
322 def test_chebder(self):
323 # check exceptions
324 assert_raises(TypeError, cheb.chebder, [0], .5)
325 assert_raises(ValueError, cheb.chebder, [0], -1)
326
327 # check that zeroth derivative does nothing
328 for i in range(5):
329 tgt = [0]*i + [1]
330 res = cheb.chebder(tgt, m=0)
331 assert_equal(trim(res), trim(tgt))
332
333 # check that derivation is the inverse of integration
334 for i in range(5):
335 for j in range(2, 5):
336 tgt = [0]*i + [1]
337 res = cheb.chebder(cheb.chebint(tgt, m=j), m=j)
338 assert_almost_equal(trim(res), trim(tgt))
339
340 # check derivation with scaling
341 for i in range(5):
342 for j in range(2, 5):
343 tgt = [0]*i + [1]
344 res = cheb.chebder(cheb.chebint(tgt, m=j, scl=2), m=j, scl=.5)
345 assert_almost_equal(trim(res), trim(tgt))
346
347 def test_chebder_axis(self):
348 # 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