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

To generate a pseudo Vandermonde matrix of the Hermite polynomial with complex coordinates, use the hermite.hermvander2d() function in NumPy. This function creates a 2D Vandermonde matrix where each row corresponds to a point and columns represent different polynomial terms.

Syntax

numpy.polynomial.hermite.hermvander2d(x, y, deg)

Parameters

The function accepts the following parameters:

  • x, y − Arrays of point coordinates with the same shape. Complex values are automatically handled.
  • deg − List of maximum degrees in the form [x_deg, y_deg].

Example

Let's create a pseudo Vandermonde matrix using complex coordinate arrays:

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

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

print("Array1...")
print(x)
print("\nArray2...")
print(y)

print("\nArray1 datatype:", x.dtype)
print("Array2 datatype:", y.dtype)

print("\nDimensions of Array1:", x.ndim)
print("Dimensions of Array2:", y.ndim)

print("\nShape of Array1:", x.shape)
print("Shape of Array2:", y.shape)

# Generate pseudo Vandermonde matrix with degrees [2, 3]
x_deg, y_deg = 2, 3
result = H.hermvander2d(x, y, [x_deg, y_deg])
print("\nPseudo Vandermonde Matrix:")
print(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,)

Pseudo Vandermonde Matrix:
[[ 1.000e+00 +0.j  2.000e+00 +4.j -1.400e+01+16.j -1.000e+02-40.j
  -4.000e+00 +4.j -2.400e+01 -8.j -8.000e+00-120.j  5.600e+02-240.j
  -2.000e+00-32.j  1.240e+02-72.j  5.400e+02+416.j -1.080e+03+3280.j]
 [ 1.000e+00 +0.j  4.000e+00 +4.j -2.000e+01+32.j -1.520e+02+104.j
  -2.000e+00 +4.j -2.400e+01 +8.j -1.240e+02-72.j -1.120e+02-816.j
  -1.400e+01-16.j  8.000e+00-120.j  5.400e+02-416.j  3.792e+03+976.j]]

How It Works

The function generates a matrix where:

  • Each row represents one coordinate point from the input arrays
  • Each column represents a term H_i(x) * H_j(y) where i ? x_deg and j ? y_deg
  • For degrees [2, 3], the matrix has (2+1) × (3+1) = 12 columns
  • Complex dtypes are automatically preserved in the output

Conclusion

The hermvander2d() function efficiently creates pseudo Vandermonde matrices for Hermite polynomials with complex coordinates. This is particularly useful for polynomial fitting and interpolation in complex domains.

Updated on: 2026-03-26T20:21:27+05:30

225 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements