Integrate a Laguerre series and set the order of integration in Python

To integrate a Laguerre series, use the laguerre.lagint() method in Python. The method returns the Laguerre series coefficients c integrated m times from lbnd along axis. At each iteration the resulting series is multiplied by scl and an integration constant, k, is added.

Syntax

numpy.polynomial.laguerre.lagint(c, m=1, k=[], lbnd=0, scl=1, axis=0)

Parameters

The function accepts the following parameters ?

  • c ? Array of Laguerre series coefficients. If c is multidimensional, different axes correspond to different variables
  • m ? Order of integration, must be positive (Default: 1)
  • k ? Integration constant(s). If k == [] (default), all constants are set to zero
  • lbnd ? Lower bound of the integral (Default: 0)
  • scl ? Scaling factor applied after each integration (Default: 1)
  • axis ? Axis over which the integral is taken (Default: 0)

Example 1: Basic Integration

Let's start with a simple integration of a Laguerre series ?

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

# Create an array of coefficients
c = np.array([1, 2, 3])
print("Original coefficients:", c)

# Integrate once (m=1)
result1 = L.lagint(c, m=1)
print("Integrated once:", result1)

# Integrate twice (m=2)
result2 = L.lagint(c, m=2)
print("Integrated twice:", result2)
Original coefficients: [1 2 3]
Integrated once: [ 1. -1.  2. -1.]
Integrated twice: [ 1. -2.  3. -3.  1.]

Example 2: Setting Integration Order

Here's how to set a higher order of integration ?

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

# Create coefficients
c = np.array([1, 2, 3])
print("Original coefficients:", c)

# Integrate with order m=3
result = L.lagint(c, m=3)
print("Integrated 3 times:")
print(result)

# Display array properties
print("Shape:", result.shape)
print("Datatype:", result.dtype)
Original coefficients: [1 2 3]
Integrated 3 times:
[ 1. -1.  0. -4.  7. -3.]
Shape: (6,)
Datatype: float64

Example 3: Using Integration Constants

You can specify integration constants using the k parameter ?

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

c = np.array([1, 2, 3])

# Integration with constants
result_no_const = L.lagint(c, m=2, k=[])
result_with_const = L.lagint(c, m=2, k=[1, 2])

print("Without constants:", result_no_const)
print("With constants [1, 2]:", result_with_const)
Without constants: [ 1. -2.  3. -3.  1.]
With constants [1, 2]: [ 1. -1.  5. -3.  1.]

How Integration Order Affects Results

Integration Order (m) Output Length Description
1 n + 1 Single integration
2 n + 2 Double integration
3 n + 3 Triple integration

Conclusion

The laguerre.lagint() method integrates Laguerre series coefficients with customizable order and constants. Higher integration orders produce longer coefficient arrays, and integration constants can be specified to control boundary conditions.

Updated on: 2026-03-26T20:15:29+05:30

239 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements