MCPcopy Index your code
hub / github.com/numpy/numpy / test_integ

Function test_integ

numpy/polynomial/tests/test_classes.py:448–474  ·  view source on GitHub ↗
(Poly)

Source from the content-addressed store, hash-verified

446
447
448def 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
477def test_deriv(Poly):

Callers

nothing calls this directly

Calls 3

assert_poly_almost_equalFunction · 0.85
castMethod · 0.45
integMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…