在 Python 中使用 2d 系数数组评估 x、y 和 z 的笛卡尔积上的 3-D Hermite 系列

要在 x、y 和 z 的笛卡尔积上评估 3-D Hermite 系列,请使用d(x, y, z, c)Python 中的 hermite.hermgrid3 方法。该方法返回二维多项式在 x、y 和 z 的笛卡尔积中的点处的值。

参数是 x、y、z。三维序列在 x、y 和 z 的笛卡尔积中的点进行评估。如果 x、`y` 或 z 是列表或元组,则首先将其转换为 ndarray,否则保持不变,如果不是 ndarray,则将其视为标量。

参数 c 是一个已排序的系数数组,以便 i,j 次项的系数包含在 c[i,j] 中。如果 c 的维度大于两个,则其余索引会枚举多组系数。如果 c 的维度少于三个,则将隐式附加到其形状以使其成为 3-D。结果的形状将是 c.shape[3:] + x.shape+ y.shape+ z.shape。

脚步

首先,导入所需的库 -

import numpy as np

fromnumpy.polynomialimport hermite 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 和 z 的笛卡尔积上评估 3-D Hermite 系列,请使用d(x, y, z, c)Python 中的 hermite.hermgrid3 方法 -

print("\nResult...\n",H.hermgrid3d([1,2],[1,2],[1,2],c))

示例

import numpy as np

fromnumpy.polynomialimport hermite 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 和 z 的笛卡尔积上评估 3-D Hermite 系列,请使用 Python 中的 hermite.hermgrid3d(x, y, z, c) 方法

print("\nResult...\n",H.hermgrid3d([1,2],[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...

   [[ 86. 154.]

   [152. 272.]]

以上是 在 Python 中使用 2d 系数数组评估 x、y 和 z 的笛卡尔积上的 3-D Hermite 系列 的全部内容, 来源链接: utcz.com/z/297208.html

回到顶部