Generate a Vandermonde matrix of the Laguerre polynomial with float array of points in Python

To generate a Vandermonde matrix of the Laguerre polynomial, use the laguerre.lagvander() method in NumPy. This function returns a pseudo-Vandermonde matrix where each row contains the Laguerre polynomial values evaluated at a specific point.

The Laguerre polynomials are orthogonal polynomials used in mathematical analysis and physics. The Vandermonde matrix has shape x.shape + (deg + 1,), where the last index corresponds to the polynomial degree.

Syntax

numpy.polynomial.laguerre.lagvander(x, deg)

Parameters

x: Array of points. Converted to float64 or complex128 depending on element types. Scalar values are converted to 1-D arrays.

deg: Degree of the resulting matrix. Determines the number of polynomial terms.

Example

Let's create a Vandermonde matrix of Laguerre polynomials with degree 2 ?

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

# Create an array of points
x = np.array([0, 3.5, -1.4, 2.5])

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

# Check array properties
print("\nDimensions:", x.ndim)
print("Datatype:", x.dtype)
print("Shape:", x.shape)

# Generate Vandermonde matrix of Laguerre polynomial with degree 2
result = L.lagvander(x, 2)
print("\nVandermonde Matrix:")
print(result)
Our Array...
[ 0.   3.5 -1.4  2.5]

Dimensions: 1
Datatype: float64
Shape: (4,)

Vandermonde Matrix:
[[ 1.     1.     1.   ]
 [ 1.    -2.5    0.125]
 [ 1.     2.4    4.78 ]
 [ 1.    -1.5   -0.875]]

How It Works

Each row in the matrix corresponds to one point from the input array. Each column represents a Laguerre polynomial of increasing degree (0, 1, 2, ...):

  • Column 0: L?(x) = 1 (constant)
  • Column 1: L?(x) = 1 - x
  • Column 2: L?(x) = (2 - 4x + x²)/2

Different Degrees

You can specify different polynomial degrees ?

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

x = np.array([0, 1, 2])

# Degree 1 matrix
print("Degree 1:")
print(L.lagvander(x, 1))

print("\nDegree 3:")
print(L.lagvander(x, 3))
Degree 1:
[[ 1.  1.]
 [ 1.  0.]
 [ 1. -1.]]

Degree 3:
[[ 1.    1.    1.    1.  ]
 [ 1.    0.   -1.   -1.  ]
 [ 1.   -1.   -1.    1.  ]]

Conclusion

The lagvander() function creates a Vandermonde matrix where each row contains Laguerre polynomial values for a given point. This is useful for polynomial fitting and mathematical computations involving orthogonal polynomials.

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

205 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements