Để tạo ma trận Vandermonde của đa thức Hermite_e, hãy sử dụng hermite_e.hermevander () trong Python Numpy. Phương thức này trả về ma trận giả Vandermonde. Hình dạng của ma trận trả về là x.shape + (deg + 1,), trong đó Chỉ số cuối cùng là mức độ của Hermite_epolynomial tương ứng. Loại dtype sẽ giống như x đã chuyển đổi.
Tham số, x trả về một Mảng điểm. Loại dtype được chuyển đổi thành float64 hoặc complex128 tùy thuộc vào việc liệu bất kỳ phần tử nào có phức tạp hay không. Nếu x là vô hướng, nó sẽ được chuyển đổi thành mảng 1-D. Tham số, deg là bậc của ma trận kết quả.
Các bước
Đầu tiên, hãy nhập thư viện được yêu cầu -
import numpy as np from numpy.polynomial import hermite_e as H
Tạo một mảng -
x = np.array([0, 1, -1, 2])
Hiển thị mảng -
print("Our Array...\n",c) Kiểm tra các thứ nguyên -
print("\nDimensions of our Array...\n",c.ndim) Lấy Datatype -
print("\nDatatype of our Array object...\n",c.dtype) Lấy hình dạng -
print("\nShape of our Array object...\n",c.shape) Để tạo ma trận Vandermonde của đa thức Hermite_e, hãy sử dụng hermite_e.hermevander () trong Python Numpy -
print("\nResult...\n",H.hermevander(x, 2)) Ví dụ
import numpy as np
from numpy.polynomial import hermite_e as H
# Create an array
x = np.array([0, 1, -1, 2])
# Display the array
print("Our Array...\n",x)
# Check the Dimensions
print("\nDimensions of our Array...\n",x.ndim)
# Get the Datatype
print("\nDatatype of our Array object...\n",x.dtype)
# Get the Shape
print("\nShape of our Array object...\n",x.shape)
# To generate a Vandermonde matrix of the Hermite_e polynomial, use the hermite_e.hermevander() in Python Numpy
print("\nResult...\n",H.hermevander(x, 2)) Đầu ra
Our Array... [ 0 1 -1 2] Dimensions of our Array... 1 Datatype of our Array object... int64 Shape of our Array object... (4,) Result... [[ 1. 0. -1.] [ 1. 1. 0.] [ 1. -1. 0.] [ 1. 2. 3.]]