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

Method test_hermfromroots

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

Source from the content-addressed store, hash-verified

526class TestMisc:
527
528 def test_hermfromroots(self):
529 res = herm.hermfromroots([])
530 assert_almost_equal(trim(res), [1])
531 for i in range(1, 5):
532 roots = np.cos(np.linspace(-np.pi, 0, 2 * i + 1)[1::2])
533 pol = herm.hermfromroots(roots)
534 res = herm.hermval(roots, pol)
535 tgt = 0
536 assert_(len(pol) == i + 1)
537 assert_almost_equal(herm.herm2poly(pol)[-1], 1)
538 assert_almost_equal(res, tgt)
539
540 def test_hermroots(self):
541 assert_almost_equal(herm.hermroots([1]), [])

Callers

nothing calls this directly

Calls 4

assert_almost_equalFunction · 0.90
assert_Function · 0.90
linspaceMethod · 0.80
trimFunction · 0.70

Tested by

no test coverage detected