Integrate a polynomial. Returns the polynomial coefficients `c` integrated `m` times from `lbnd` along `axis`. At each iteration the resulting series is **multiplied** by `scl` and an integration constant, `k`, is added. The scaling factor is for use in a linear change of vari
(c, m=1, k=[], lbnd=0, scl=1, axis=0)
| 543 | |
| 544 | |
| 545 | def polyint(c, m=1, k=[], lbnd=0, scl=1, axis=0): |
| 546 | """ |
| 547 | Integrate a polynomial. |
| 548 | |
| 549 | Returns the polynomial coefficients `c` integrated `m` times from |
| 550 | `lbnd` along `axis`. At each iteration the resulting series is |
| 551 | **multiplied** by `scl` and an integration constant, `k`, is added. |
| 552 | The scaling factor is for use in a linear change of variable. ("Buyer |
| 553 | beware": note that, depending on what one is doing, one may want `scl` |
| 554 | to be the reciprocal of what one might expect; for more information, |
| 555 | see the Notes section below.) The argument `c` is an array of |
| 556 | coefficients, from low to high degree along each axis, e.g., [1,2,3] |
| 557 | represents the polynomial ``1 + 2*x + 3*x**2`` while [[1,2],[1,2]] |
| 558 | represents ``1 + 1*x + 2*y + 2*x*y`` if axis=0 is ``x`` and axis=1 is |
| 559 | ``y``. |
| 560 | |
| 561 | Parameters |
| 562 | ---------- |
| 563 | c : array_like |
| 564 | 1-D array of polynomial coefficients, ordered from low to high. |
| 565 | m : int, optional |
| 566 | Order of integration, must be positive. (Default: 1) |
| 567 | k : {[], list, scalar}, optional |
| 568 | Integration constant(s). The value of the first integral at zero |
| 569 | is the first value in the list, the value of the second integral |
| 570 | at zero is the second value, etc. If ``k == []`` (the default), |
| 571 | all constants are set to zero. If ``m == 1``, a single scalar can |
| 572 | be given instead of a list. |
| 573 | lbnd : scalar, optional |
| 574 | The lower bound of the integral. (Default: 0) |
| 575 | scl : scalar, optional |
| 576 | Following each integration the result is *multiplied* by `scl` |
| 577 | before the integration constant is added. (Default: 1) |
| 578 | axis : int, optional |
| 579 | Axis over which the integral is taken. (Default: 0). |
| 580 | |
| 581 | .. versionadded:: 1.7.0 |
| 582 | |
| 583 | Returns |
| 584 | ------- |
| 585 | S : ndarray |
| 586 | Coefficient array of the integral. |
| 587 | |
| 588 | Raises |
| 589 | ------ |
| 590 | ValueError |
| 591 | If ``m < 1``, ``len(k) > m``, ``np.ndim(lbnd) != 0``, or |
| 592 | ``np.ndim(scl) != 0``. |
| 593 | |
| 594 | See Also |
| 595 | -------- |
| 596 | polyder |
| 597 | |
| 598 | Notes |
| 599 | ----- |
| 600 | Note that the result of each integration is *multiplied* by `scl`. Why |
| 601 | is this important to note? Say one is making a linear change of |
| 602 | variable :math:`u = ax + b` in an integral relative to `x`. Then |
nothing calls this directly
no test coverage detected