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

Function polypow

numpy/polynomial/polynomial.py:424–460  ·  view source on GitHub ↗

Raise a polynomial to a power. Returns the polynomial `c` raised to the power `pow`. The argument `c` is a sequence of coefficients ordered from low to high. i.e., [1,2,3] is the series ``1 + 2*x + 3*x**2.`` Parameters ---------- c : array_like 1-D array of array o

(c, pow, maxpower=None)

Source from the content-addressed store, hash-verified

422
423
424def polypow(c, pow, maxpower=None):
425 """Raise a polynomial to a power.
426
427 Returns the polynomial `c` raised to the power `pow`. The argument
428 `c` is a sequence of coefficients ordered from low to high. i.e.,
429 [1,2,3] is the series ``1 + 2*x + 3*x**2.``
430
431 Parameters
432 ----------
433 c : array_like
434 1-D array of array of series coefficients ordered from low to
435 high degree.
436 pow : integer
437 Power to which the series will be raised
438 maxpower : integer, optional
439 Maximum power allowed. This is mainly to limit growth of the series
440 to unmanageable size. Default is 16
441
442 Returns
443 -------
444 coef : ndarray
445 Power series of power.
446
447 See Also
448 --------
449 polyadd, polysub, polymulx, polymul, polydiv
450
451 Examples
452 --------
453 >>> from numpy.polynomial import polynomial as P
454 >>> P.polypow([1,2,3], 2)
455 array([ 1., 4., 10., 12., 9.])
456
457 """
458 # note: this is more efficient than `pu._pow(polymul, c1, c2)`, as it
459 # avoids calling `as_series` repeatedly
460 return pu._pow(np.convolve, c, pow, maxpower)
461
462
463def polyder(c, m=1, scl=1, axis=0):

Callers

nothing calls this directly

Calls 1

_powMethod · 0.80

Tested by

no test coverage detected