diff options
Diffstat (limited to 'numpy/polynomial/tests')
-rw-r--r-- | numpy/polynomial/tests/test_chebyshev.py | 11 | ||||
-rw-r--r-- | numpy/polynomial/tests/test_hermite.py | 11 | ||||
-rw-r--r-- | numpy/polynomial/tests/test_hermite_e.py | 11 | ||||
-rw-r--r-- | numpy/polynomial/tests/test_laguerre.py | 11 | ||||
-rw-r--r-- | numpy/polynomial/tests/test_legendre.py | 11 | ||||
-rw-r--r-- | numpy/polynomial/tests/test_polynomial.py | 11 |
6 files changed, 66 insertions, 0 deletions
diff --git a/numpy/polynomial/tests/test_chebyshev.py b/numpy/polynomial/tests/test_chebyshev.py index 439dfa08d..6169b4120 100644 --- a/numpy/polynomial/tests/test_chebyshev.py +++ b/numpy/polynomial/tests/test_chebyshev.py @@ -3,6 +3,8 @@ """ from __future__ import division, absolute_import, print_function +from functools import reduce + import numpy as np import numpy.polynomial.chebyshev as cheb from numpy.polynomial.polynomial import polyval @@ -111,6 +113,15 @@ class TestArithmetic(object): res = cheb.chebadd(cheb.chebmul(quo, ci), rem) assert_equal(trim(res), trim(tgt), err_msg=msg) + def test_chebpow(self): + for i in range(5): + for j in range(5): + msg = "At i=%d, j=%d" % (i, j) + c = np.arange(i + 1) + tgt = reduce(cheb.chebmul, [c]*j) if j else np.array([1]) + res = cheb.chebpow(c, j) + assert_equal(trim(res), trim(tgt), err_msg=msg) + class TestEvaluation(object): # coefficients of 1 + 2*x + 3*x**2 diff --git a/numpy/polynomial/tests/test_hermite.py b/numpy/polynomial/tests/test_hermite.py index 18c26af8f..284d906da 100644 --- a/numpy/polynomial/tests/test_hermite.py +++ b/numpy/polynomial/tests/test_hermite.py @@ -3,6 +3,8 @@ """ from __future__ import division, absolute_import, print_function +from functools import reduce + import numpy as np import numpy.polynomial.hermite as herm from numpy.polynomial.polynomial import polyval @@ -99,6 +101,15 @@ class TestArithmetic(object): res = herm.hermadd(herm.hermmul(quo, ci), rem) assert_equal(trim(res), trim(tgt), err_msg=msg) + def test_hermpow(self): + for i in range(5): + for j in range(5): + msg = "At i=%d, j=%d" % (i, j) + c = np.arange(i + 1) + tgt = reduce(herm.hermmul, [c]*j) if j else np.array([1]) + res = herm.hermpow(c, j) + assert_equal(trim(res), trim(tgt), err_msg=msg) + class TestEvaluation(object): # coefficients of 1 + 2*x + 3*x**2 diff --git a/numpy/polynomial/tests/test_hermite_e.py b/numpy/polynomial/tests/test_hermite_e.py index 58d74dae9..149a0ee95 100644 --- a/numpy/polynomial/tests/test_hermite_e.py +++ b/numpy/polynomial/tests/test_hermite_e.py @@ -3,6 +3,8 @@ """ from __future__ import division, absolute_import, print_function +from functools import reduce + import numpy as np import numpy.polynomial.hermite_e as herme from numpy.polynomial.polynomial import polyval @@ -99,6 +101,15 @@ class TestArithmetic(object): res = herme.hermeadd(herme.hermemul(quo, ci), rem) assert_equal(trim(res), trim(tgt), err_msg=msg) + def test_hermepow(self): + for i in range(5): + for j in range(5): + msg = "At i=%d, j=%d" % (i, j) + c = np.arange(i + 1) + tgt = reduce(herme.hermemul, [c]*j) if j else np.array([1]) + res = herme.hermepow(c, j) + assert_equal(trim(res), trim(tgt), err_msg=msg) + class TestEvaluation(object): # coefficients of 1 + 2*x + 3*x**2 diff --git a/numpy/polynomial/tests/test_laguerre.py b/numpy/polynomial/tests/test_laguerre.py index 3cb630e46..e95091006 100644 --- a/numpy/polynomial/tests/test_laguerre.py +++ b/numpy/polynomial/tests/test_laguerre.py @@ -3,6 +3,8 @@ """ from __future__ import division, absolute_import, print_function +from functools import reduce + import numpy as np import numpy.polynomial.laguerre as lag from numpy.polynomial.polynomial import polyval @@ -96,6 +98,15 @@ class TestArithmetic(object): res = lag.lagadd(lag.lagmul(quo, ci), rem) assert_almost_equal(trim(res), trim(tgt), err_msg=msg) + def test_lagpow(self): + for i in range(5): + for j in range(5): + msg = "At i=%d, j=%d" % (i, j) + c = np.arange(i + 1) + tgt = reduce(lag.lagmul, [c]*j) if j else np.array([1]) + res = lag.lagpow(c, j) + assert_equal(trim(res), trim(tgt), err_msg=msg) + class TestEvaluation(object): # coefficients of 1 + 2*x + 3*x**2 diff --git a/numpy/polynomial/tests/test_legendre.py b/numpy/polynomial/tests/test_legendre.py index aeecd8775..323728a46 100644 --- a/numpy/polynomial/tests/test_legendre.py +++ b/numpy/polynomial/tests/test_legendre.py @@ -3,6 +3,8 @@ """ from __future__ import division, absolute_import, print_function +from functools import reduce + import numpy as np import numpy.polynomial.legendre as leg from numpy.polynomial.polynomial import polyval @@ -100,6 +102,15 @@ class TestArithmetic(object): res = leg.legadd(leg.legmul(quo, ci), rem) assert_equal(trim(res), trim(tgt), err_msg=msg) + def test_legpow(self): + for i in range(5): + for j in range(5): + msg = "At i=%d, j=%d" % (i, j) + c = np.arange(i + 1) + tgt = reduce(leg.legmul, [c]*j) if j else np.array([1]) + res = leg.legpow(c, j) + assert_equal(trim(res), trim(tgt), err_msg=msg) + class TestEvaluation(object): # coefficients of 1 + 2*x + 3*x**2 diff --git a/numpy/polynomial/tests/test_polynomial.py b/numpy/polynomial/tests/test_polynomial.py index 67728e35e..b5a3678a4 100644 --- a/numpy/polynomial/tests/test_polynomial.py +++ b/numpy/polynomial/tests/test_polynomial.py @@ -3,6 +3,8 @@ """ from __future__ import division, absolute_import, print_function +from functools import reduce + import numpy as np import numpy.polynomial.polynomial as poly from numpy.testing import ( @@ -102,6 +104,15 @@ class TestArithmetic(object): res = poly.polyadd(poly.polymul(quo, ci), rem) assert_equal(res, tgt, err_msg=msg) + def test_polypow(self): + for i in range(5): + for j in range(5): + msg = "At i=%d, j=%d" % (i, j) + c = np.arange(i + 1) + tgt = reduce(poly.polymul, [c]*j) if j else np.array([1]) + res = poly.polypow(c, j) + assert_equal(trim(res), trim(tgt), err_msg=msg) + class TestEvaluation(object): # coefficients of 1 + 2*x + 3*x**2 |