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

To generate a pseudo Vandermonde matrix of the Laguerre polynomial, use the laguerre.lagvander2d() method in Python NumPy. The method returns a 2D pseudo-Vandermonde matrix where each element is evaluated using Laguerre polynomial basis functions at the given complex points.

The method takes arrays of x and y coordinates and degree specifications to construct the matrix. The shape of the returned matrix is x.shape + (x_deg + 1) * (y_deg + 1), where the dtype matches the input arrays (complex128 for complex inputs).

Syntax

laguerre.lagvander2d(x, y, deg)

Parameters

The parameters are ?

  • x, y ? Arrays of points with the same shape. Complex values are preserved as complex128
  • deg ? List of maximum degrees [x_deg, y_deg] for each dimension

Example

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

import numpy as np
from numpy.polynomial import laguerre as L

# Create arrays of complex point coordinates
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 and shape
print("\nDimensions of Array1...\n", x.ndim)
print("\nDimensions of Array2...\n", y.ndim)
print("\nShape of Array1...\n", x.shape)
print("\nShape of Array2...\n", y.shape)

# Generate pseudo Vandermonde matrix with degrees 2 and 3
x_deg, y_deg = 2, 3
result = L.lagvander2d(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  0. -2.j
   -2.5 -2.j  -4.66666667 +0.33333333j
    3. -2.j  -4. -6.j
   -11.5 -1.j  -13.33333333 +10.33333333j
    5. -8.j  -16. -10.j
   -28.5 +10.j -20.66666667 +39.j ]
 [  1. +0.j  -1. -2.j
   -3. +0.j  -2.33333333 +3.33333333j
    2. -2.j  -6. -2.j
   -6. +6.j   2. +11.33333333j
    1.5 -6.j  -13.5 +3.j
   -4.5 +18.j  16.5 +19.j ]]

How It Works

The function evaluates Laguerre polynomials at each point combination. With degrees [2, 3], it creates a matrix with (2+1) × (3+1) = 12 columns for each input point. Each row corresponds to one input point, and columns represent different polynomial degree combinations.

Conclusion

The lagvander2d() function generates pseudo Vandermonde matrices for 2D Laguerre polynomial interpolation. It handles complex arrays automatically and returns results that preserve the complex dtype of input coordinates.

Updated on: 2026-03-26T20:17:07+05:30

194 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements