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

Method test_legfromroots

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

Source from the content-addressed store, hash-verified

517class TestMisc:
518
519 def test_legfromroots(self):
520 res = leg.legfromroots([])
521 assert_almost_equal(trim(res), [1])
522 for i in range(1, 5):
523 roots = np.cos(np.linspace(-np.pi, 0, 2*i + 1)[1::2])
524 pol = leg.legfromroots(roots)
525 res = leg.legval(roots, pol)
526 tgt = 0
527 assert_(len(pol) == i + 1)
528 assert_almost_equal(leg.leg2poly(pol)[-1], 1)
529 assert_almost_equal(res, tgt)
530
531 def test_legroots(self):
532 assert_almost_equal(leg.legroots([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