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

To generate a Vandermonde matrix of the Hermite polynomial with complex array points, use the hermite.hermvander() function in Python NumPy. This method returns the pseudo-Vandermonde matrix where each row corresponds to an evaluation point and each column represents a different degree of the Hermite polynomial.

The returned matrix has shape x.shape + (deg + 1,), where the last index corresponds to the degree of the Hermite polynomial. The dtype will match the converted input array.

Parameters

  • x ? Array of points. Converts to float64 or complex128 depending on whether elements are complex. Scalar inputs are converted to 1-D arrays.
  • deg ? Degree of the resulting matrix (determines number of columns).

Example

Let's create a Vandermonde matrix using complex points ?

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

# Create an array of complex points
x = np.array([-2.+2.j, -1.+2.j, 0.+2.j, 1.+2.j, 2.+2.j])

# Display the array
print("Our Array...")
print(x)

# Check array properties
print("\nDimensions of our Array...")
print(x.ndim)

print("\nDatatype of our Array object...")
print(x.dtype)

print("\nShape of our Array object...")
print(x.shape)

# Generate Vandermonde matrix of degree 2
print("\nVandermonde Matrix (degree 2)...")
result = H.hermvander(x, 2)
print(result)
Our Array...
[-2.+2.j -1.+2.j  0.+2.j  1.+2.j  2.+2.j]

Dimensions of our Array...
1

Datatype of our Array object...
complex128

Shape of our Array object...
(5,)

Vandermonde Matrix (degree 2)...
[[ 1. +0.j -4. +4.j -2.-32.j]
 [ 1. +0.j -2. +4.j -14.-16.j]
 [ 1. +0.j  0. +4.j -18. +0.j]
 [ 1. +0.j  2. +4.j -14.+16.j]
 [ 1. +0.j  4. +4.j -2.+32.j]]

Matrix Structure

The resulting 5×3 matrix contains:

  • Column 0 ? H?(x) = 1 (degree 0 Hermite polynomial)
  • Column 1 ? H?(x) = 2x (degree 1 Hermite polynomial)
  • Column 2 ? H?(x) = 4x² - 2 (degree 2 Hermite polynomial)

Each row represents the evaluation of all polynomial degrees at one complex point from the input array.

Conclusion

The hermite.hermvander() function efficiently creates Vandermonde matrices for Hermite polynomials with complex inputs. This is useful for polynomial interpolation and approximation tasks involving complex-valued functions.

Updated on: 2026-03-26T20:37:02+05:30

236 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements