(Poly)
| 428 | |
| 429 | |
| 430 | def test_integ(Poly): |
| 431 | P = Polynomial |
| 432 | # Check defaults |
| 433 | p0 = Poly.cast(P([1*2, 2*3, 3*4])) |
| 434 | p1 = P.cast(p0.integ()) |
| 435 | p2 = P.cast(p0.integ(2)) |
| 436 | assert_poly_almost_equal(p1, P([0, 2, 3, 4])) |
| 437 | assert_poly_almost_equal(p2, P([0, 0, 1, 1, 1])) |
| 438 | # Check with k |
| 439 | p0 = Poly.cast(P([1*2, 2*3, 3*4])) |
| 440 | p1 = P.cast(p0.integ(k=1)) |
| 441 | p2 = P.cast(p0.integ(2, k=[1, 1])) |
| 442 | assert_poly_almost_equal(p1, P([1, 2, 3, 4])) |
| 443 | assert_poly_almost_equal(p2, P([1, 1, 1, 1, 1])) |
| 444 | # Check with lbnd |
| 445 | p0 = Poly.cast(P([1*2, 2*3, 3*4])) |
| 446 | p1 = P.cast(p0.integ(lbnd=1)) |
| 447 | p2 = P.cast(p0.integ(2, lbnd=1)) |
| 448 | assert_poly_almost_equal(p1, P([-9, 2, 3, 4])) |
| 449 | assert_poly_almost_equal(p2, P([6, -9, 1, 1, 1])) |
| 450 | # Check scaling |
| 451 | d = 2*Poly.domain |
| 452 | p0 = Poly.cast(P([1*2, 2*3, 3*4]), domain=d) |
| 453 | p1 = P.cast(p0.integ()) |
| 454 | p2 = P.cast(p0.integ(2)) |
| 455 | assert_poly_almost_equal(p1, P([0, 2, 3, 4])) |
| 456 | assert_poly_almost_equal(p2, P([0, 0, 1, 1, 1])) |
| 457 | |
| 458 | |
| 459 | def test_deriv(Poly): |
nothing calls this directly
no test coverage detected