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

To generate a pseudo Vandermonde matrix of the Hermite polynomial with x, y, z complex array coordinates, use the hermite.hermvander3d() method in NumPy. This function returns a 3D pseudo-Vandermonde matrix where each coordinate array contributes to different polynomial degrees.

Syntax

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

Parameters

x, y, z: Arrays of point coordinates with the same shape. Complex and float dtypes are automatically converted to complex128 or float64.

deg: List of maximum degrees [x_deg, y_deg, z_deg] for each coordinate.

Example

Let's create complex coordinate arrays and generate their Hermite pseudo-Vandermonde matrix ?

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([0.+2.j, 1.+2.j])
z = np.array([2.+2.j, 3.+3.j])

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

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

# Check dimensions and shape
print("\nDimensions of Array1...\n", x.ndim)
print("\nDimensions of Array2...\n", y.ndim)
print("\nDimensions of Array3...\n", z.ndim)

print("\nShape of Array1...\n", x.shape)
print("\nShape of Array2...\n", y.shape)
print("\nShape of Array3...\n", z.shape)

# 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("\nResult...\n", result)
Array1...
 [-2.+2.j -1.+2.j]

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

Array3...
 [2.+2.j 3.+3.j]

Array1 datatype...
 complex128

Array2 datatype...
 complex128

Array3 datatype...
 complex128

Dimensions of Array1...
 1

Dimensions of Array2...
 1

Dimensions of Array3...
 1

Shape of Array1...
 (2,)

Shape of Array2...
 (2,)

Shape of Array3...
 (2,)

Result...
 [[ 1.000000e+00+0.000000e+00j  4.000000e+00+4.000000e+00j
  -2.000000e+00+3.200000e+01j -1.520000e+02+1.040000e+02j
  -1.012000e+03-3.840000e+02j  0.000000e+00+4.000000e+00j
  -1.600000e+01+1.600000e+01j -1.280000e+02-8.000000e+00j
  -4.160000e+02-6.080000e+02j  1.536000e+03-4.048000e+03j
  -1.800000e+01+0.000000e+00j -7.200000e+01-7.200000e+01j
   3.600000e+01-5.760000e+02j  2.736000e+03-1.872000e+03j
   1.821600e+04+6.912000e+03j  0.000000e+00-8.800000e+01j
   3.520000e+02-3.520000e+02j  2.816000e+03+1.760000e+02j
   9.152000e+03+1.337600e+04j -3.379200e+04+8.905600e+04j
  -4.000000e+00+4.000000e+00j -3.200000e+01+0.000000e+00j
  -1.200000e+02-1.360000e+02j  1.920000e+02-1.024000e+03j
   5.584000e+03-2.512000e+03j -1.600000e+01-1.600000e+01j
   0.000000e+00-1.280000e+02j  5.440000e+02-4.800000e+02j
   4.096000e+03+7.680000e+02j  1.004800e+04+2.233600e+04j
   7.200000e+01-7.200000e+01j  5.760000e+02+0.000000e+00j
   2.160000e+03+2.448000e+03j -3.456000e+03+1.843200e+04j
  -1.005120e+05+4.521600e+04j  3.520000e+02+3.520000e+02j
   0.000000e+00+2.816000e+03j -1.196800e+04+1.056000e+04j
  -9.011200e+04-1.689600e+04j -2.210560e+05-4.913920e+05j
  -2.000000e+00-3.200000e+01j  1.200000e+02-1.360000e+02j
   1.028000e+03+0.000000e+00j  3.632000e+03+4.656000e+03j
  -1.026400e+04+3.315200e+04j  1.280000e+02-8.000000e+00j
   5.440000e+02+4.800000e+02j  0.000000e+00+4.112000e+03j
  -1.862400e+04+1.452800e+04j -1.326080e+05-4.105600e+04j
   3.600000e+01+5.760000e+02j -2.160000e+03+2.448000e+03j
  -1.850400e+04+0.000000e+00j -6.537600e+04-8.380800e+04j
   1.847520e+05-5.967360e+05j -2.816000e+03+1.760000e+02j
  -1.196800e+04-1.056000e+04j  0.000000e+00-9.046400e+04j
   4.097280e+05-3.196160e+05j  2.917376e+06+9.032320e+05j]
 [ 1.000000e+00+0.000000e+00j  6.000000e+00+6.000000e+00j
  -2.000000e+00+7.200000e+01j -4.680000e+02+3.960000e+02j
  -5.172000e+03-8.640000e+02j  2.000000e+00+4.000000e+00j
  -1.200000e+01+3.600000e+01j -2.920000e+02+1.360000e+02j
  -2.520000e+03-1.080000e+03j -6.888000e+03-2.241600e+04j
  -1.400000e+01+1.600000e+01j -1.800000e+02+1.200000e+01j
  -1.124000e+03-1.040000e+03j  2.160000e+02-1.303200e+04j
   8.623200e+04-7.065600e+04j -1.000000e+02-4.000000e+01j
  -3.600000e+02-8.400000e+02j  3.080000e+03-7.120000e+03j
   6.264000e+04-2.088000e+04j  4.826400e+05+2.932800e+05j
  -2.000000e+00+4.000000e+00j -3.600000e+01+1.200000e+01j
  -2.840000e+02-1.520000e+02j -6.480000e+02-2.664000e+03j
   1.380000e+04-1.896000e+04j -2.000000e+01+0.000000e+00j
  -1.200000e+02-1.200000e+02j  4.000000e+01-1.440000e+03j
   9.360000e+03-7.920000e+03j  1.034400e+05+1.728000e+04j
  -3.600000e+01-8.800000e+01j  3.120000e+02-7.440000e+02j
   6.408000e+03-2.416000e+03j  5.169600e+04+2.692800e+04j
   1.101600e+05+4.862400e+05j  3.600000e+02-3.200000e+02j
   4.080000e+03+2.400000e+02j  2.232000e+04+2.656000e+04j
  -4.176000e+04+2.923200e+05j -2.138400e+06+1.344000e+06j
  -1.400000e+01-1.600000e+01j  1.200000e+01-1.800000e+02j
   1.180000e+03-9.760000e+02j  1.288800e+04+1.944000e+03j
   5.858400e+04+9.484800e+04j  3.600000e+01-8.800000e+01j
   7.440000e+02-3.120000e+02j  6.264000e+03+2.768000e+03j
   1.800000e+04+5.544000e+04j -2.622240e+05+4.240320e+05j
   4.520000e+02+0.000000e+00j  2.712000e+03+2.712000e+03j
  -9.040000e+02+3.254400e+04j -2.115360e+05+1.789920e+05j
  -2.337744e+06-3.905280e+05j  7.600000e+02+2.160000e+03j
  -8.400000e+03+1.752000e+04j -1.570400e+05+5.040000e+04j
  -1.211040e+06-7.099200e+05j -2.064480e+06-1.182816e+07j]]

How It Works

The function creates a 3D pseudo-Vandermonde matrix where:

− Each row corresponds to a point from the input arrays

− Each column represents a combination of Hermite polynomial terms

− The matrix shape is (n_points, (x_deg+1)*(y_deg+1)*(z_deg+1))

− Complex coordinates automatically promote the result to complex128 dtype

Conclusion

The hermvander3d() function generates pseudo-Vandermonde matrices for 3D Hermite polynomial fitting with complex coordinates. Use it for polynomial interpolation and curve fitting in three-dimensional complex space.

Updated on: 2026-03-26T19:16:02+05:30

194 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements