(Poly)
| 446 | |
| 447 | |
| 448 | def test_integ(Poly): |
| 449 | P = Polynomial |
| 450 | # Check defaults |
| 451 | p0 = Poly.cast(P([1 * 2, 2 * 3, 3 * 4])) |
| 452 | p1 = P.cast(p0.integ()) |
| 453 | p2 = P.cast(p0.integ(2)) |
| 454 | assert_poly_almost_equal(p1, P([0, 2, 3, 4])) |
| 455 | assert_poly_almost_equal(p2, P([0, 0, 1, 1, 1])) |
| 456 | # Check with k |
| 457 | p0 = Poly.cast(P([1 * 2, 2 * 3, 3 * 4])) |
| 458 | p1 = P.cast(p0.integ(k=1)) |
| 459 | p2 = P.cast(p0.integ(2, k=[1, 1])) |
| 460 | assert_poly_almost_equal(p1, P([1, 2, 3, 4])) |
| 461 | assert_poly_almost_equal(p2, P([1, 1, 1, 1, 1])) |
| 462 | # Check with lbnd |
| 463 | p0 = Poly.cast(P([1 * 2, 2 * 3, 3 * 4])) |
| 464 | p1 = P.cast(p0.integ(lbnd=1)) |
| 465 | p2 = P.cast(p0.integ(2, lbnd=1)) |
| 466 | assert_poly_almost_equal(p1, P([-9, 2, 3, 4])) |
| 467 | assert_poly_almost_equal(p2, P([6, -9, 1, 1, 1])) |
| 468 | # Check scaling |
| 469 | d = 2 * Poly.domain |
| 470 | p0 = Poly.cast(P([1 * 2, 2 * 3, 3 * 4]), domain=d) |
| 471 | p1 = P.cast(p0.integ()) |
| 472 | p2 = P.cast(p0.integ(2)) |
| 473 | assert_poly_almost_equal(p1, P([0, 2, 3, 4])) |
| 474 | assert_poly_almost_equal(p2, P([0, 0, 1, 1, 1])) |
| 475 | |
| 476 | |
| 477 | def test_deriv(Poly): |
nothing calls this directly
no test coverage detected
searching dependent graphs…