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

ประเมินอนุกรม Hermite_e ที่อาร์เรย์จุด x ใน Python

บทนำ

เมธอด hermite_e.hermeval() ประเมินอนุกรม Hermite_e ที่จุด x รองรับอาร์เรย์หลายมิติ

ตัวอย่าง: x เป็นอาร์เรย์ 2 มิติ

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

c = np.array([1, 2, 3])
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 = np.array([[1, 2], [3, 4]])
print("\nResult...\n", H.hermeval(x, c))

ผลลัพธ์

Our Array... [1 2 3]
Dimensions of our Array... 1
Datatype of our Array object... int64
Shape of our Array object... (3,)
Result... [[ 3. 14.]
 [31. 54.]]

อนุกรม H₀ + 2H₁ + 3H₂ ประเมินที่จุด 4 จุดในเมทริกซ์ 2x2