Generate a Pseudo Vandermonde matrix of the Hermite_e polynomial with complex array of points coordinates in Python

To generate a pseudo Vandermonde matrix of the Hermite_e polynomial with complex coordinates, use the hermite_e.hermevander2d() function in NumPy. This function returns a pseudo-Vandermonde matrix where the parameters x and y are arrays of point coordinates with the same shape. The data types are automatically converted to float64 or complex128 depending on whether any elements are complex.

Syntax

numpy.polynomial.hermite_e.hermevander2d(x, y, deg)

Parameters

The function accepts the following parameters:

  • x, y ? Arrays of point coordinates, all of the same shape
  • deg ? List of maximum degrees in the form [x_deg, y_deg]

Example

Let's create a complete example demonstrating how to generate a pseudo Vandermonde matrix with complex coordinates ?

import numpy as np
from numpy.polynomial import hermite_e as H

# Create arrays of point coordinates with complex numbers
x = np.array([-2.+2.j, -1.+2.j])
y = np.array([1.+2.j, 2.+2.j])

# Display the arrays
print("Array1...\n", x)
print("\nArray2...\n", y)

# Display the datatype
print("\nArray1 datatype...\n", x.dtype)
print("\nArray2 datatype...\n", y.dtype)

# Check the Dimensions of both arrays
print("\nDimensions of Array1...\n", x.ndim)
print("\nDimensions of Array2...\n", y.ndim)

# Check the Shape of both arrays
print("\nShape of Array1...\n", x.shape)
print("\nShape of Array2...\n", y.shape)

# Generate pseudo Vandermonde matrix with degrees [2, 3]
x_deg, y_deg = 2, 3
result = H.hermevander2d(x, y, [x_deg, y_deg])
print("\nResult...\n", result)
Array1...
 [-2.+2.j -1.+2.j]

Array2...
 [1.+2.j 2.+2.j]

Array1 datatype...
 complex128

Array2 datatype...
 complex128

Dimensions of Array1...
 1

Dimensions of Array2...
 1

Shape of Array1...
 (2,)

Shape of Array2...
 (2,)

Result...
 [[ 1. +0.j  1. +2.j  -4. +4.j -14. -8.j  -2. +2.j  -6. -2.j
    0.-16.j  44.-12.j  -1. -8.j  15.-10.j  36.+28.j -50.+120.j]
  [ 1. +0.j  2. +2.j  -1. +8.j -22.+10.j  -1. +2.j  -6. +2.j
   -15.-10.j   2.-54.j  -4. -4.j   0.-16.j  36.-28.j 128. +48.j]]

How It Works

The hermevander2d() function generates a 2D pseudo Vandermonde matrix by evaluating Hermite_e polynomials at the given coordinate points. With degrees [2, 3], it creates a matrix with (x_deg + 1) * (y_deg + 1) = 3 * 4 = 12 columns. Each row corresponds to one coordinate pair (x[i], y[i]), and each column represents a different polynomial basis function.

Key Points

  • Complex input arrays are automatically handled with complex128 dtype
  • The output matrix has shape (len(x), (x_deg + 1) * (y_deg + 1))
  • Scalars are automatically converted to 1-D arrays
  • Both coordinate arrays must have the same shape

Conclusion

The hermite_e.hermevander2d() function efficiently generates pseudo Vandermonde matrices for Hermite_e polynomials with complex coordinates. This is useful for polynomial fitting and interpolation in two dimensions with complex data.

Updated on: 2026-03-26T20:43:03+05:30

197 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements