บทนำ
การประเมินค่าอนุกรม Hermite_e 3 มิติ (3D Hermite_e Series) ที่จุด (x, y, z) สามารถทำได้โดยใช้เมธอด hermite.hermeval3d() ใน NumPy เมธอดนี้จะคืนค่าของพหุนามหลายมิติที่จุดที่สร้างจากค่าที่สอดคล้องกันของ x, y และ z
พารามิเตอร์
- พารามิเตอร์ที่ 1 (x, y, z): อนุกรม 3 มิติจะถูกประเมินที่จุด (x, y, z) โดยที่ x, y, z ต้องมีรูปร่างเท่ากัน หากเป็น list หรือ tuple จะถูกแปลงเป็น ndarray
- พารามิเตอร์ที่ 2 (C): อาร์เรย์ของสัมประสิทธิ์ที่เรียงลำดับ כךที่ สัมประสิทธิ์ของพจน์ที่มี multi-degree i,j,k อยู่ใน c[i,j,k] หาก c มีมิติมากกว่า 3 ดัชนีที่เหลือจะนับชุดสัมประสิทธิ์หลายชุด
ขั้นตอนการทำงาน
1. นำเข้าไลบรารี
import numpy as np from numpy.polynomial import hermite_e as H
2. สร้างอาร์เรย์สัมประสิทธิ์ 2D
c = np.arange(4).reshape(2, 2)
3. แสดงอาร์เรย์
print("Our Array...\n", c)
4. ตรวจสอบมิติ
print("\nDimensions of our Array...\n", c.ndim)
5. ตรวจสอบชนิดข้อมูล
print("\nDatatype of our Array object...\n", c.dtype)
6. ตรวจสอบรูปร่าง
print("\nShape of our Array object...\n", c.shape)
7. ประเมินอนุกรม Hermite_e 3 มิติ
print("\nResult...\n", H.hermeval3d([1, 2], [1, 2], [1, 2], c))
ตัวอย่างโค้ดสมบูรณ์
import numpy as np
from numpy.polynomial import hermite_e as H
# สร้างอาร์เรย์สัมประสิทธิ์ 2D
c = np.arange(4).reshape(2, 2)
# แสดงอาร์เรย์
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)
# ประเมินอนุกรม Hermite_e 3 มิติ
print("\nResult...\n", H.hermeval3d([1, 2], [1, 2], [1, 2], c))
ผลลัพธ์ที่คาดหวัง
Our Array... [[0 1] [2 3]] Dimensions of our Array... 2 Datatype of our Array object... int64 Shape of our Array object... (2, 2) Result... [24. 42.]