Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Generate a Pseudo Vandermonde matrix of the Hermite_e polynomial with float array of points coordinates in Python
To generate a pseudo Vandermonde matrix of the Hermite_e polynomial, use the hermite_e.hermevander2d() function in NumPy. This method returns a pseudo-Vandermonde matrix where each row corresponds to a point coordinate and each column represents polynomial basis functions up to specified degrees.
Syntax
numpy.polynomial.hermite_e.hermevander2d(x, y, deg)
Parameters
The function accepts the following parameters:
- x, y: Arrays of point coordinates with the same shape. Data types are converted to float64 or complex128 automatically.
- deg: List specifying maximum degrees as [x_deg, y_deg].
Complete Example
Let's create a complete example demonstrating the generation of a pseudo Vandermonde matrix ?
import numpy as np
from numpy.polynomial import hermite_e as H
# Create arrays of point coordinates
x = np.array([0.1, 1.4])
y = np.array([1.7, 2.8])
# Display the arrays
print("Array x:", x)
print("Array y:", y)
# Display array properties
print("\nArray x datatype:", x.dtype)
print("Array y datatype:", y.dtype)
print("Array x dimensions:", x.ndim)
print("Array y dimensions:", y.ndim)
print("Array x shape:", x.shape)
print("Array y shape:", y.shape)
# Generate pseudo Vandermonde matrix
x_deg, y_deg = 2, 3
result = H.hermevander2d(x, y, [x_deg, y_deg])
print("\nPseudo Vandermonde matrix:")
print(result)
Array x: [0.1 1.4] Array y: [1.7 2.8] Array x datatype: float64 Array y datatype: float64 Array x dimensions: 1 Array y dimensions: 1 Array x shape: (2,) Array y shape: (2,) Pseudo Vandermonde matrix: [[ 1.000000e+00 1.700000e+00 1.890000e+00 -1.870000e-01 1.000000e-01 1.700000e-01 1.890000e-01 -1.870000e-02 -9.900000e-01 -1.683000e+00 -1.871100e+00 1.851300e-01] [ 1.000000e+00 2.800000e+00 6.840000e+00 1.355200e+01 1.400000e+00 3.920000e+00 9.576000e+00 1.897280e+01 9.600000e-01 2.688000e+00 6.566400e+00 1.300992e+01]]
Understanding the Output
The resulting matrix has dimensions (2, 12). Each row corresponds to a coordinate pair (x[i], y[i]), and the 12 columns represent different polynomial basis functions formed by combinations of Hermite_e polynomials up to degrees (2, 3).
Matrix Dimensions
The number of columns in the pseudo Vandermonde matrix is calculated as (x_deg + 1) × (y_deg + 1) = (2 + 1) × (3 + 1) = 12 columns.
Conclusion
The hermite_e.hermevander2d() function efficiently generates pseudo Vandermonde matrices for 2D Hermite_e polynomials. This is useful for polynomial fitting and interpolation problems in two dimensions.
