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

Method test_approximation

numpy/polynomial/tests/test_classes.py:591–600  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

589 assert_(Chebyshev.interpolate(self.f, deg).degree() == deg)
590
591 def test_approximation(self):
592
593 def powx(x, p):
594 return x**p
595
596 x = np.linspace(0, 2, 10)
597 for deg in range(0, 10):
598 for t in range(0, deg + 1):
599 p = Chebyshev.interpolate(powx, deg, domain=[0, 2], args=(t,))
600 assert_almost_equal(p(x), powx(x, t), decimal=11)

Callers

nothing calls this directly

Calls 4

assert_almost_equalFunction · 0.90
pFunction · 0.85
linspaceMethod · 0.80
interpolateMethod · 0.45

Tested by

no test coverage detected