numpy.polynomial.laguerre.lagtrim

原文:https://docs.scipy.org/doc/numpy/reference/generated/numpy.polynomial.laguerre.lagtrim.html

译者:飞龙 UsyiyiCN

校对:(虚位以待)

numpy.polynomial.laguerre.lagtrim(c, tol=0)[source]

从多项式中删除“小”“拖尾”系数。

“Small” means “small in absolute value” and is controlled by the parameter tol; “trailing” means highest order coefficient(s), e.g., in [0, 1, 1, 0, 0] (which represents 0 + x + x**2 + 0*x**3 + 0*x**4) both the 3-rd and 4-th order coefficients would be “trimmed.”

参数:

c:array_like

1-d数组的系数,从最低到最高排序。

tol:number,可选

移除绝对值小于或等于to1(默认值为零)的尾随(即,最高阶)元素。

返回:

修剪:ndarray

删除尾随零的1-d数组。如果结果序列为空,则返回包含单个零的序列。

上升:

ValueError

如果tol

也可以看看

trimseq

例子

>>> from numpy import polynomial as P
>>> P.trimcoef((0,0,3,0,5,0,0))
array([ 0.,  0.,  3.,  0.,  5.])
>>> P.trimcoef((0,0,1e-3,0,1e-5,0,0),1e-3) # item == tol is trimmed
array([ 0.])
>>> i = complex(0,1) # works for complex
>>> P.trimcoef((3e-4,1e-3*(1-i),5e-4,2e-5*(1+i)), 1e-3)
array([ 0.0003+0.j   ,  0.0010-0.001j])