ใช้ hermgrid2d กับอาร์เรย์係ณ 3 มิติ (shape (2, 2, 6)) มิติที่สามแทนชุด係ณ 6 ชุด
ขั้นตอน
import numpy as np
from numpy.polynomial import hermite as H
c = np.arange(24).reshape(2, 2, 6)
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)
print("\nResult...\n", H.hermgrid2d([1, 2], [1, 2], c))
ตัวอย่างโค้ดสมบูรณ์
import numpy as np
from numpy.polynomial import hermite as H
c = np.arange(24).reshape(2, 2, 6)
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)
print("\nResult...\n", H.hermgrid2d([1, 2], [1, 2], c))
ผลลัพธ์
Our Array... [[[ 0 1 2 3 4 5] [ 6 7 8 9 10 11]] [[12 13 14 15 16 17] [18 19 20 21 22 23]]] Dimensions of our Array... 3 Datatype of our Array object... int64 Shape of our Array object... (2, 2, 6) Result... [[[108. 192.] [204. 360.]] [[117. 207.] [219. 385.]] [[126. 222.] [234. 410.]] [[135. 237.] [249. 435.]] [[144. 252.] [264. 460.]] [[153. 267.] [279. 485.]]]