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

Function chebmul

numpy/polynomial/chebyshev.py:701–747  ·  view source on GitHub ↗

Multiply one Chebyshev series by another. Returns the product of two Chebyshev series `c1` * `c2`. The arguments are sequences of coefficients, from lowest order "term" to highest, e.g., [1,2,3] represents the series ``T_0 + 2*T_1 + 3*T_2``. Parameters ---------- c1,

(c1, c2)

Source from the content-addressed store, hash-verified

699
700
701def chebmul(c1, c2):
702 """
703 Multiply one Chebyshev series by another.
704
705 Returns the product of two Chebyshev series `c1` * `c2`. The arguments
706 are sequences of coefficients, from lowest order "term" to highest,
707 e.g., [1,2,3] represents the series ``T_0 + 2*T_1 + 3*T_2``.
708
709 Parameters
710 ----------
711 c1, c2 : array_like
712 1-D arrays of Chebyshev series coefficients ordered from low to
713 high.
714
715 Returns
716 -------
717 out : ndarray
718 Of Chebyshev series coefficients representing their product.
719
720 See Also
721 --------
722 chebadd, chebsub, chebmulx, chebdiv, chebpow
723
724 Notes
725 -----
726 In general, the (polynomial) product of two C-series results in terms
727 that are not in the Chebyshev polynomial basis set. Thus, to express
728 the product as a C-series, it is typically necessary to "reproject"
729 the product onto said basis set, which typically produces
730 "unintuitive live" (but correct) results; see Examples section below.
731
732 Examples
733 --------
734 >>> from numpy.polynomial import chebyshev as C
735 >>> c1 = (1,2,3)
736 >>> c2 = (3,2,1)
737 >>> C.chebmul(c1,c2) # multiplication requires "reprojection"
738 array([ 6.5, 12. , 12. , 4. , 1.5])
739
740 """
741 # c1, c2 are trimmed copies
742 [c1, c2] = pu.as_series([c1, c2])
743 z1 = _cseries_to_zseries(c1)
744 z2 = _cseries_to_zseries(c2)
745 prd = _zseries_mul(z1, z2)
746 ret = _zseries_to_cseries(prd)
747 return pu.trimseq(ret)
748
749
750def chebdiv(c1, c2):

Callers

nothing calls this directly

Calls 3

_cseries_to_zseriesFunction · 0.85
_zseries_mulFunction · 0.85
_zseries_to_cseriesFunction · 0.85

Tested by

no test coverage detected