(self)
| 320 | class TestDerivative: |
| 321 | |
| 322 | def test_chebder(self): |
| 323 | # check exceptions |
| 324 | assert_raises(TypeError, cheb.chebder, [0], .5) |
| 325 | assert_raises(ValueError, cheb.chebder, [0], -1) |
| 326 | |
| 327 | # check that zeroth derivative does nothing |
| 328 | for i in range(5): |
| 329 | tgt = [0]*i + [1] |
| 330 | res = cheb.chebder(tgt, m=0) |
| 331 | assert_equal(trim(res), trim(tgt)) |
| 332 | |
| 333 | # check that derivation is the inverse of integration |
| 334 | for i in range(5): |
| 335 | for j in range(2, 5): |
| 336 | tgt = [0]*i + [1] |
| 337 | res = cheb.chebder(cheb.chebint(tgt, m=j), m=j) |
| 338 | assert_almost_equal(trim(res), trim(tgt)) |
| 339 | |
| 340 | # check derivation with scaling |
| 341 | for i in range(5): |
| 342 | for j in range(2, 5): |
| 343 | tgt = [0]*i + [1] |
| 344 | res = cheb.chebder(cheb.chebint(tgt, m=j, scl=2), m=j, scl=.5) |
| 345 | assert_almost_equal(trim(res), trim(tgt)) |
| 346 | |
| 347 | def test_chebder_axis(self): |
| 348 | # check that axis keyword works |
nothing calls this directly
no test coverage detected