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

ประเมินค่าอนุกรมเฮอร์ไมท์ที่จุด x ด้วยอาร์เรย์係ณหลายมิติใน Python

เมธอด hermite.hermval() ประเมินค่าอนุกรมเฮอร์ไมท์ที่จุด x ด้วยอาร์เรย์係ณหลายมิติ พารามิเตอร์ tensor=True (ค่าเริ่มต้น) ทำให้ทุกคอลัมน์ของ係ณถูกประเมินสำหรับทุกสมาชิกของ x

ขั้นตอน

import numpy as np
from numpy.polynomial import hermite 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.hermval([1, 2], c))

ตัวอย่างโค้ดสมบูรณ์

import numpy as np
from numpy.polynomial import hermite 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.hermval([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... [[ 7. 13.] [10. 18.]]