要在点 (x, y) 处评估 2D Hermite_e 系列,请使用d()Python Numpy 中的 hermite.hermeval2 方法。该方法返回二维多项式在点处的值,这些点由来自 x 和 y 的对应值对组成。
第一个参数是 x,y。二维序列在点 (x, y) 处计算,其中 x 和 y 必须具有相同的形状。如果 x 或 y 是列表或元组,则首先将其转换为 ndarray,否则保持不变,如果它不是 ndarray,则将其视为标量。
第二个参数 C 是一个有序的系数数组,使得多度 i,j 项的系数包含在 c[i,j] 中。如果 c 的维度大于两个,则其余索引会枚举多组系数。
脚步
首先,导入所需的库 -
import numpy as np fromnumpy.polynomialimport hermite_e as H
创建一个多维系数数组 -
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)
要在点 (x, y) 评估 2D Hermite_e 系列,请使用d()Python Numpy 中的 hermite.hermeval2 方法 -
print("\nResult...\n",H.hermeval2d([1,2],[1,2],c))
示例
import numpy as np fromnumpy.polynomialimport hermite_e as H #创建一个多维系数数组 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) #要在点 (x, y) 评估 2D Hermite_e 系列,请使用 Python Numpy 中的 hermite.hermeval2d() 方法 print("\nResult...\n",H.hermeval2d([1,2],[1,2],c))输出结果
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... [ 6. 18.]