Convert a Laguerre series to a polynomial in Python

To convert a Laguerre series to a polynomial, use the laguerre.lag2poly() method in Python NumPy. This function converts an array representing the coefficients of a Laguerre series, ordered from lowest degree to highest, to an array of the coefficients of the equivalent polynomial (relative to the "standard" basis) ordered from lowest to highest degree.

The method returns a 1-D array containing the coefficients of the equivalent polynomial ordered from lowest order term to highest. The parameter c is a 1-D array containing the Laguerre series coefficients, ordered from lowest order term to highest.

Syntax

numpy.polynomial.laguerre.lag2poly(c)

Parameters

c ? 1-D array containing the Laguerre series coefficients, ordered from lowest order term to highest.

Example

Let's create a simple example to demonstrate the conversion ?

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

# Create an array using the numpy.array() method
c = np.array([1, 2, 3, 4, 5])

# Display the array
print("Our Array...\n", c)

# Check the Dimensions
print("\nDimensions of our Array...\n", c.ndim)

# Get the Datatype
print("\nDatatype of our Array object...\n", c.dtype)

# Get the Shape
print("\nShape of our Array object...\n", c.shape)

# To convert a Laguerre series to a polynomial, use the laguerre.lag2poly() method
print("\nResult (laguerre to polynomial)...\n", L.lag2poly(c))
Our Array...
 [1 2 3 4 5]

Dimensions of our Array...
1

Datatype of our Array object...
int64

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

Result (laguerre to polynomial)...
 [ 15.         -40.          22.5         -4.           0.20833333]

Simple Example with Smaller Coefficients

Here's a simpler example to better understand the conversion ?

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

# Simple Laguerre series coefficients
coefficients = np.array([1, 1, 1])
print("Laguerre series coefficients:", coefficients)

# Convert to polynomial
polynomial = L.lag2poly(coefficients)
print("Equivalent polynomial coefficients:", polynomial)
Laguerre series coefficients: [1 1 1]
Equivalent polynomial coefficients: [ 3. -3.  0.5]

How It Works

The Laguerre polynomials form an orthogonal basis, and each Laguerre polynomial can be expressed as a linear combination of standard monomials. The lag2poly() function performs this transformation by computing the equivalent polynomial representation in the standard basis.

Conclusion

The numpy.polynomial.laguerre.lag2poly() method efficiently converts Laguerre series coefficients to standard polynomial coefficients. This is useful when you need to work with polynomial representations in the standard monomial basis rather than the Laguerre basis.

Updated on: 2026-03-26T20:38:11+05:30

229 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements