(self)
| 308 | class TestDerivative: |
| 309 | |
| 310 | def test_hermder(self): |
| 311 | # check exceptions |
| 312 | assert_raises(TypeError, herm.hermder, [0], .5) |
| 313 | assert_raises(ValueError, herm.hermder, [0], -1) |
| 314 | |
| 315 | # check that zeroth derivative does nothing |
| 316 | for i in range(5): |
| 317 | tgt = [0]*i + [1] |
| 318 | res = herm.hermder(tgt, m=0) |
| 319 | assert_equal(trim(res), trim(tgt)) |
| 320 | |
| 321 | # check that derivation is the inverse of integration |
| 322 | for i in range(5): |
| 323 | for j in range(2, 5): |
| 324 | tgt = [0]*i + [1] |
| 325 | res = herm.hermder(herm.hermint(tgt, m=j), m=j) |
| 326 | assert_almost_equal(trim(res), trim(tgt)) |
| 327 | |
| 328 | # check derivation with scaling |
| 329 | for i in range(5): |
| 330 | for j in range(2, 5): |
| 331 | tgt = [0]*i + [1] |
| 332 | res = herm.hermder(herm.hermint(tgt, m=j, scl=2), m=j, scl=.5) |
| 333 | assert_almost_equal(trim(res), trim(tgt)) |
| 334 | |
| 335 | def test_hermder_axis(self): |
| 336 | # check that axis keyword works |
nothing calls this directly
no test coverage detected