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