numpy.polynomial.legendre.legint

原文:https://docs.scipy.org/doc/numpy/reference/generated/numpy.polynomial.legendre.legint.html

译者:飞龙 UsyiyiCN

校对:(虚位以待)

numpy.polynomial.legendre.legint(c, m=1, k=[], lbnd=0, scl=1, axis=0)[source]

集成Legendre系列。

lbnd沿返回累积m次的Legendre系数c在每次迭代中,通过scl将所得到的系列相乘,并且添加积分常数k缩放因子用于变量的线性变化。(“买方谨慎”:请注意,根据用户的操作,可能希望scl是所期望的倒数;有关详细信息,请参阅下面的“注释”部分。The argument c is an array of coefficients from low to high degree along each axis, e.g., [1,2,3] represents the series L_0 + 2*L_1 + 3*L_2 while [[1,2],[1,2]] represents 1*L_0(x)*L_0(y) + 1*L_1(x)*L_0(y) + 2*L_0(x)*L_1(y) + 2*L_1(x)*L_1(y) if axis=0 is x and axis=1 is y.

参数:

c:array_like

Legendre系数的数组。如果c是多维的,则不同的轴对应于不同的变量,每个轴中的度由相应的索引给出。

m:int,可选

整合顺序,必须是积极的。(默认值:1)

k:{[],list,scalar},可选

积分常数。lbnd处的第一个积分的值是列表中的第一个值,lbnd处的第二个积分的值是第二个值等。如果k == [](默认值),所有常数都设置为零。如果m == 1,可以给出单个标量而不是列表。

lbnd:标量,可选

积分的下限。(默认值:0)

scl:标量,可选

Following each integration the result is multiplied by scl before the integration constant is added. (默认值:1)

axis:int,可选

进行积分的轴。(默认值:0)。

版本1.7.0中的新功能。

返回:

S:ndarray

Legendre系数数组的积分。

上升:

ValueError

如果m 0len(k) > mnp.isscalar(lbnd) == / t11>np.isscalar(scl) == False

也可以看看

legder

笔记

请注意,每次积分的结果乘以scl为什么这一点很重要?假设变量u = ax + b在相对于x的积分中进行线性变化。然后.. math :: dx = du / a,因此需要设置scl等于1/a - 也许不是一开始就想到的。

还要注意,一般来说,集成C系列的结果需要“重新投射”到C系列基本集上。因此,通常,该函数的结果是“不直观的”,虽然正确;请参阅下面的示例部分。

例子

>>> from numpy.polynomial import legendre as L
>>> c = (1,2,3)
>>> L.legint(c)
array([ 0.33333333,  0.4       ,  0.66666667,  0.6       ])
>>> L.legint(c, 3)
array([  1.66666667e-02,  -1.78571429e-02,   4.76190476e-02,
        -1.73472348e-18,   1.90476190e-02,   9.52380952e-03])
>>> L.legint(c, k=3)
array([ 3.33333333,  0.4       ,  0.66666667,  0.6       ])
>>> L.legint(c, lbnd=-2)
array([ 7.33333333,  0.4       ,  0.66666667,  0.6       ])
>>> L.legint(c, scl=2)
array([ 0.66666667,  0.8       ,  1.33333333,  1.2       ])