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

Method test_simple_polynomial

numpy/polynomial/tests/test_printing.py:389–408  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

387 del obj._repr_latex_scalar
388
389 def test_simple_polynomial(self):
390 # default input
391 p = poly.Polynomial([1, 2, 3])
392 assert_equal(self.as_latex(p),
393 r'$x \mapsto 1.0 + 2.0\,x + 3.0\,x^{2}$')
394
395 # translated input
396 p = poly.Polynomial([1, 2, 3], domain=[-2, 0])
397 assert_equal(self.as_latex(p),
398 r'$x \mapsto 1.0 + 2.0\,\left(1.0 + x\right) + 3.0\,\left(1.0 + x\right)^{2}$')
399
400 # scaled input
401 p = poly.Polynomial([1, 2, 3], domain=[-0.5, 0.5])
402 assert_equal(self.as_latex(p),
403 r'$x \mapsto 1.0 + 2.0\,\left(2.0x\right) + 3.0\,\left(2.0x\right)^{2}$')
404
405 # affine input
406 p = poly.Polynomial([1, 2, 3], domain=[-1, 0])
407 assert_equal(self.as_latex(p),
408 r'$x \mapsto 1.0 + 2.0\,\left(1.0 + 2.0x\right) + 3.0\,\left(1.0 + 2.0x\right)^{2}$')
409
410 def test_basis_func(self):
411 p = poly.Chebyshev([1, 2, 3])

Callers

nothing calls this directly

Calls 2

as_latexMethod · 0.95
assert_equalFunction · 0.90

Tested by

no test coverage detected