ในการส่งคืนเมทริกซ์ที่แสดงร่วมที่ปรับขนาดของอาร์เรย์ 1-D ของสัมประสิทธิ์พหุนาม ให้ส่งคืนเมธอด thehermite_e.hermecompanion() ใน Python Numpy พหุนามพื้นฐานได้รับการปรับขนาดเพื่อให้เมทริกซ์ที่แสดงร่วมมีความสมมาตรเมื่อ c เป็นพหุนามพื้นฐาน Hermite_e สิ่งนี้ให้ค่าประมาณค่าลักษณะเฉพาะที่ดีกว่ากรณีที่ไม่ได้มาตราส่วน และสำหรับพหุนามพื้นฐาน ค่าลักษณะเฉพาะรับประกันว่าเป็นจริง หากใช้ numpy.linalg.eigvalsh เพื่อให้ได้มา
เมธอดส่งคืนเมทริกซ์สหายที่ปรับขนาดของมิติข้อมูล (deg, deg) พารามิเตอร์ c คืออาร์เรย์ 1- D ของสัมประสิทธิ์อนุกรมเฮอร์ไมต์เรียงจากระดับต่ำไปสูง
ขั้นตอน
ขั้นแรก นำเข้าไลบรารีที่จำเป็น -
import numpy as np from numpy.polynomial import hermite_e as H
สร้างอาร์เรย์ 1D ของสัมประสิทธิ์ -
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) ในการส่งคืนเมทริกซ์สหายที่ปรับขนาดของอาร์เรย์ 1-D ของสัมประสิทธิ์พหุนาม ให้ส่งคืนเมธอด thehermite_e.hermecompanion() ใน Python -
print("\nResult...\n",H.hermecompanion(c)) ตัวอย่าง
import numpy as np
from numpy.polynomial import hermite_e as H
# Create a 1D array of coefficients
c = np.array([1, 2, 3])
# Display the array
print("Our Array...\n",c)
# Check the Dimensions
print("\nDimensions of our Array...\n",c.ndim)
# Get the Datatype
print("\nDatatype of our Array object...\n",c.dtype)
# Get the Shape
print("\nShape of our Array object...\n",c.shape)
# To return the scaled companion matrix of a 1-D array of polynomial coefficients, return the hermite_e.hermecompanion() method in Python Numpy
print("\nResult...\n",H.hermecompanion(c)) ผลลัพธ์
Our Array... [1 2 3] Dimensions of our Array... 1 Datatype of our Array object... int64 Shape of our Array object... (3,) Result... [[ 0. 0.66666667] [ 1. -0.66666667]]