MCPcopy Create free account
hub / github.com/numpy/numpy / test_integ

Function test_integ

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

Source from the content-addressed store, hash-verified

428
429
430def 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
459def 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