Generate a Pseudo Vandermonde matrix of Hermite polynomial and x, y, z floating array of points in Python

To generate a pseudo Vandermonde matrix of the Hermite polynomial and x, y, z sample points, use the hermite.hermvander3d() method in NumPy. This method returns the pseudo-Vandermonde matrix where the parameter x, y, z are arrays of point coordinates, all of the same shape. The deg parameter is a list of maximum degrees of the form [x_deg, y_deg, z_deg].

Syntax

The basic syntax is ?

hermite.hermvander3d(x, y, z, deg)

Parameters

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

Example

Let's create arrays of point coordinates and generate the pseudo Vandermonde matrix ?

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

# Create arrays of point coordinates
x = np.array([1.5, 2.3])
y = np.array([3.7, 4.4])
z = np.array([5.3, 6.6])

print("X coordinates:", x)
print("Y coordinates:", y)
print("Z coordinates:", z)

# Generate pseudo Vandermonde matrix
x_deg, y_deg, z_deg = 2, 3, 4
result = H.hermvander3d(x, y, z, [x_deg, y_deg, z_deg])

print("\nMatrix shape:", result.shape)
print("\nPseudo Vandermonde matrix:")
print(result)
X coordinates: [1.5 2.3]
Y coordinates: [3.7 4.4]
Z coordinates: [5.3 6.6]

Matrix shape: (2, 60)

Pseudo Vandermonde matrix:
[[1.00000000e+00 1.06000000e+01 1.10360000e+02 1.12741600e+03
  1.12884496e+04 7.40000000e+00 7.84400000e+01 8.16664000e+02
  8.34287840e+03 8.35345270e+04 5.27600000e+01 5.59256000e+02
  5.82259360e+03 5.94824682e+04 5.95578601e+05 3.60824000e+02
  3.82473440e+03 3.98205366e+04 4.06798751e+05 4.07314354e+06
  3.00000000e+00 3.18000000e+01 3.31080000e+02 3.38224800e+03
  3.38653488e+04 2.22000000e+01 2.35320000e+02 2.44999200e+03
  2.50286352e+04 2.50603581e+05 1.58280000e+02 1.67776800e+03
  1.74677808e+04 1.78447404e+05 1.78673580e+06 1.08247200e+03
  1.14742032e+04 1.19461610e+05 1.22039625e+06 1.22194306e+07
  7.00000000e+00 7.42000000e+01 7.72520000e+02 7.89191200e+03
  7.90191472e+04 5.18000000e+01 5.49080000e+02 5.71664800e+03
  5.84001488e+04 5.84741689e+05 3.69320000e+02 3.91479200e+03
  4.07581552e+04 4.16377277e+05 4.16905021e+06 2.52576800e+03
  2.67731408e+04 2.78743756e+05 2.84759126e+06 2.85120048e+07]
 [1.00000000e+00 1.32000000e+01 1.72240000e+02 2.22076800e+03
  2.82806976e+04 8.80000000e+00 1.16160000e+02 1.51571200e+03
  1.95427584e+04 2.48870139e+05 7.54400000e+01 9.95808000e+02
  1.29937856e+04 1.67534738e+05 2.13349583e+06 6.28672000e+02
  8.29847040e+03 1.08282465e+05 1.39613466e+06 1.77792827e+07
  4.60000000e+00 6.07200000e+01 7.92304000e+02 1.02155328e+04
  1.30091209e+05 4.04800000e+01 5.34336000e+02 6.97227520e+03
  8.98966886e+04 1.14480264e+06 3.47024000e+02 4.58071680e+03
  5.97714138e+04 7.70659794e+05 9.81408080e+06 2.89189120e+03
  3.81729638e+04 4.98099340e+05 6.42221944e+06 8.17847005e+07
  1.91600000e+01 2.52912000e+02 3.30011840e+03 4.25499149e+04
  5.41858166e+05 1.68608000e+02 2.22562560e+03 2.90410419e+04
  3.74439251e+05 4.76835186e+06 1.44543040e+03 1.90796813e+04
  2.48960932e+05 3.20996558e+06 4.08777800e+07 1.20453555e+04
  1.58998693e+05 2.07469203e+06 2.67499401e+07 3.40651057e+08]]

Understanding the Output

The resulting matrix has dimensions (2, 60). The number of columns is calculated as (x_deg + 1) × (y_deg + 1) × (z_deg + 1) = 3 × 4 × 5 = 60. Each row corresponds to one point, and each column represents a different combination of Hermite polynomial basis functions.

Array Properties Example

Let's examine the properties of our coordinate arrays ?

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

x = np.array([1.5, 2.3])
y = np.array([3.7, 4.4])
z = np.array([5.3, 6.6])

print("Array properties:")
print(f"X - dtype: {x.dtype}, shape: {x.shape}, dimensions: {x.ndim}")
print(f"Y - dtype: {y.dtype}, shape: {y.shape}, dimensions: {y.ndim}")  
print(f"Z - dtype: {z.dtype}, shape: {z.shape}, dimensions: {z.ndim}")
Array properties:
X - dtype: float64, shape: (2,), dimensions: 1
Y - dtype: float64, shape: (2,), dimensions: 1
Z - dtype: float64, shape: (2,), dimensions: 1

Conclusion

The hermite.hermvander3d() method generates pseudo Vandermonde matrices for three-dimensional Hermite polynomials. The resulting matrix dimensions depend on the degree parameters, making it useful for polynomial fitting and evaluation in three-dimensional space.

Updated on: 2026-03-26T19:32:06+05:30

190 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements