Integrate a Chebyshev series.
Returns, as a C-series, the input C-series cs, integrated m times from lbnd to x. 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 variable. (“Buyer beware”: note that, depending on what one is doing, one may want scl to be the reciprocal of what one might expect; for more information, see the Notes section below.) The argument cs is a sequence of coefficients, from lowest order C-series “term” to highest, e.g., [1,2,3] represents the series T_0(x) + 2T_1(x) + 3T_2(x).
Parameters : | cs : array_like
m : int, optional
k : {[], list, scalar}, optional
lbnd : scalar, optional
scl : scalar, optional
|
---|---|
Returns : | S : ndarray
|
Raises : | ValueError :
|
See also
Notes
Note that the result of each integration is multiplied by scl. Why is this important to note? Say one is making a linear change of variable u = ax + b in an integral relative to x. Then dx = du/a, so one will need to set scl equal to 1/a - perhaps not what one would have first thought.
Also note that, in general, the result of integrating a C-series needs to be “re-projected” onto the C-series basis set. Thus, typically, the result of this function is “un-intuitive,” albeit correct; see Examples section below.
Examples
>>> from numpy.polynomial import chebyshev as C
>>> cs = (1,2,3)
>>> C.chebint(cs)
array([ 0.5, -0.5, 0.5, 0.5])
>>> C.chebint(cs,3)
array([ 0.03125 , -0.1875 , 0.04166667, -0.05208333, 0.01041667,
0.00625 ])
>>> C.chebint(cs, k=3)
array([ 3.5, -0.5, 0.5, 0.5])
>>> C.chebint(cs,lbnd=-2)
array([ 8.5, -0.5, 0.5, 0.5])
>>> C.chebint(cs,scl=-2)
array([-1., 1., -1., -1.])