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

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

บทนำ

เมธอด hermite_e.hermeval() ประเมินอนุกรม Hermite_e ที่จุด x ด้วยสัมประสิทธิ์หลายมิติ (tensor=True ค่าเริ่มต้น)

ตัวอย่าง: สัมประสิทธิ์ 2 มิติ [[1,2],[3,4]]

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

c = np.array([[1, 2], [3, 4]])
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.hermeval([1, 2], c))

ผลลัพธ์

Our Array... [[1 2]
 [3 4]]
Dimensions of our Array... 2
Datatype of our Array object... int64
Shape of our Array object... (2, 2)
Result... [[ 4. 7.]
 [ 6. 10.]]

x = [1, 2] 2 จุด c มี 2 คอลัมน์ → ผลลัพธ์ 2x2 เมทริกซ์

  • คอลัมน์แรก [1,3]: H₀+3H₁ ที่ x=1 → 4, ที่ x=2 → 6
  • คอลัมน์ที่สอง [2,4]: 2H₀+4H₁ ที่ x=1 → 7, ที่ x=2 → 10