diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2010-08-15 21:06:27 +0000 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2010-08-15 21:06:27 +0000 |
commit | 3ade0a810b185383e97428e8c6365da1951de436 (patch) | |
tree | 78b0cf0900368372c62ca395bd098888743a9fcf /numpy/polynomial/tests | |
parent | 0a0248000491b40e03f29a98055a7546316cc92f (diff) | |
download | numpy-3ade0a810b185383e97428e8c6365da1951de436.tar.gz |
Merge branch 'poly'
Diffstat (limited to 'numpy/polynomial/tests')
-rw-r--r-- | numpy/polynomial/tests/test_chebyshev.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/numpy/polynomial/tests/test_chebyshev.py b/numpy/polynomial/tests/test_chebyshev.py index cc23ba701..b80ff61de 100644 --- a/numpy/polynomial/tests/test_chebyshev.py +++ b/numpy/polynomial/tests/test_chebyshev.py @@ -345,6 +345,39 @@ class TestMisc(TestCase) : for i in range(10) : assert_equal(ch.poly2cheb(Tlist[i]), [0]*i + [1]) + def test_chebpts1(self): + #test exceptions + yield assert_raises(ValueError, ch.chebpts1, 1.5) + yield assert_raises(ValueError, ch.chebpts1, 0) + + #test points + tgt = [0] + yield assert_almost_equal(ch.chebpts1(1), tgt) + tgt = [-0.70710678118654746, 0.70710678118654746] + yield assert_almost_equal(ch.chebpts1(2), tgt) + tgt = [-0.86602540378443871, 0, 0.86602540378443871] + yield assert_almost_equal(ch.chebpts1(3), tgt) + tgt = [-0.9238795325, -0.3826834323, 0.3826834323, 0.9238795325] + yield assert_almost_equal(ch.chebpts1(4), tgt) + + + def test_chebpts2(self): + #test exceptions + yield assert_raises(ValueError, ch.chebpts2, 1.5) + yield assert_raises(ValueError, ch.chebpts2, 1) + + #test points + tgt = [-1, 1] + yield assert_almost_equal(ch.chebpts2(2), tgt) + tgt = [-1, 0, 1] + yield assert_almost_equal(ch.chebpts2(3), tgt) + tgt = [-1 -0.5, .5, 1] + yield assert_almost_equal(ch.chebpts2(4), tgt) + tgt = [-1.0, -0.707106781187, 0, 0.707106781187, 1.0] + yield assert_almost_equal(ch.chebpts2(5), tgt) + + + class TestChebyshevClass(TestCase) : |