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

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

บทนำ

เมธอด hermite_e.hermeval() รองรับการรับ x เป็นลิสต์ Python โดยแปลงเป็น ndarray อัตโนมัติ

ตัวอย่าง: x เป็นลิสต์ [5, 10, 15]

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 = [5, 10, 15]
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... [ 83. 318. 703.]

อนุกรม H₀ + 2H₁ + 3H₂ ประเมินที่ x = 5, 10, 15 ให้ผลลัพธ์ 3 ค่า