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

Function chebmul

numpy/polynomial/chebyshev.py:699–745  ·  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

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…