在Python中针对特定轴分别对具有多维系数的Laguerre级数进行微分
要对Laguerre级数进行微分,在Python中使用laguerre.lagder()方法。该方法返回沿着特定轴进行m次微分的Laguerre系数。在每次迭代中,结果都会乘以scl。参数c是沿着每个轴从低阶到高阶的系数数组,例如,[1,2,3]
代表系列1*L_0 + 2*L_1 + 3*L_2
,而[[1,2],[1,2]]
代表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)
,如果axis=0代表x,axis=1代表y。
第一个参数c是Laguerre级数系数的数组。如果c是多维的,则不同的轴对应于具有相应索引给出的每个轴上的变量的阶数。第二个参数m是进行的导数次数,必须是非负的(默认值为1)。第三个参数scl是一个标量,每次微分都会乘以scl。最终结果是scl的m次方乘积。这用于线性变量的变换(默认值为1)。第四个参数axis是进行导数的轴(默认值为0)。
步骤
首先,导入所需的库−
import numpy as np
from numpy.polynomial import laguerre as L
创建一个多维数组的系数−
c = np.arange(4).reshape(2,2)
显示数组 –
print("Our Array...\n",c)
检查尺寸 –
print("\nDimensions of our Array...\n",c.ndim)
获取数据类型 –
print("\nDatatype of our Array object...\n",c.dtype)
获得形状 −
print("\nShape of our Array object...\n",c.shape)
要对拉盖尔级数进行求导,可以使用Python中的laguerre.lagder()方法。
print("\nResult...\n",L.lagder(c, axis = 1))
示例
import numpy as np
from numpy.polynomial import laguerre as L
# Create a multidimensional array of coefficients
c = np.arange(4).reshape(2,2)
# Display the array
print("Our Array...\n",c)
# Check the Dimensions
print("\nDimensions of our Array...\n",c.ndim)
# Get the Datatype
print("\nDatatype of our Array object...\n",c.dtype)
# Get the Shape
print("\nShape of our Array object...\n",c.shape)
# To differentiate a Laguerre series, use the laguerre.lagder() method in Python
print("\nResult...\n",L.lagder(c, axis = 1))
输出
Our Array...
[[0 1]
[2 3]]
Dimensions of our Array...
2
Datatype of our Array object...
int64
Shape of our Array object...
(2, 2)
Result...
[[-1.]
[-3.]]