Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Python

ประเมินค่าอนุกรมเฮอร์ไมท์ 2 มิติ บนผลคูณคาร์เทเซียนของ x และ y ด้วยอาร์เรย์係ณ 1 มิติใน Python

เมธอด hermite.hermgrid2d(x, y, c) ประเมินค่าอนุกรมเฮอร์ไมท์ 2 มิติ บนผลคูณคาร์เทเซียนของ x และ y หาก c เป็น 1 มิติ จะถูกขยายเป็น 2 มิติโดยเพิ่มมิติ 1 ด้านหน้า

ขั้นตอน

import numpy as np
from numpy.polynomial import hermite as H

c = np.array([3, 5])
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.array([3, 5])
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...   [3 5]
Dimensions of our Array... 1
Datatype of our Array object... int64
Shape of our Array object... (2,)
Result...   [ 59. 105.]