(self)
| 400 | class TestDerivative: |
| 401 | |
| 402 | def test_polyder(self): |
| 403 | # check exceptions |
| 404 | assert_raises(TypeError, poly.polyder, [0], .5) |
| 405 | assert_raises(ValueError, poly.polyder, [0], -1) |
| 406 | |
| 407 | # check that zeroth derivative does nothing |
| 408 | for i in range(5): |
| 409 | tgt = [0]*i + [1] |
| 410 | res = poly.polyder(tgt, m=0) |
| 411 | assert_equal(trim(res), trim(tgt)) |
| 412 | |
| 413 | # check that derivation is the inverse of integration |
| 414 | for i in range(5): |
| 415 | for j in range(2, 5): |
| 416 | tgt = [0]*i + [1] |
| 417 | res = poly.polyder(poly.polyint(tgt, m=j), m=j) |
| 418 | assert_almost_equal(trim(res), trim(tgt)) |
| 419 | |
| 420 | # check derivation with scaling |
| 421 | for i in range(5): |
| 422 | for j in range(2, 5): |
| 423 | tgt = [0]*i + [1] |
| 424 | res = poly.polyder(poly.polyint(tgt, m=j, scl=2), m=j, scl=.5) |
| 425 | assert_almost_equal(trim(res), trim(tgt)) |
| 426 | |
| 427 | def test_polyder_axis(self): |
| 428 | # check that axis keyword works |
nothing calls this directly
no test coverage detected