Differentiate a Laguerre series with multidimensional coefficients over axis 1 in Python

To differentiate a Laguerre series with multidimensional coefficients, use the laguerre.lagder() method in Python NumPy. This method returns the Laguerre series coefficients differentiated m times along a specified axis.

The coefficient array c represents Laguerre series from low to high degree. For example, [1,2,3] represents 1*L_0 + 2*L_1 + 3*L_2, while [[1,2],[1,2]] represents a 2D series if axis=0 is x and axis=1 is y.

Syntax

numpy.polynomial.laguerre.lagder(c, m=1, scl=1, axis=0)

Parameters

c ? Array of Laguerre series coefficients. For multidimensional arrays, different axes correspond to different variables.

m ? Number of derivatives to take (default: 1). Must be non-negative.

scl ? Scalar multiplier for each differentiation (default: 1). Final result is multiplied by scl^m.

axis ? Axis over which the derivative is taken (default: 0).

Example

Let's differentiate a 2D Laguerre series along axis 1 ?

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

# Create a multidimensional array of coefficients
c = np.arange(4).reshape(2,2)

# 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)

# Differentiate along axis 1
print("\nResult...\n", L.lagder(c, axis = 1))
Our Array...
 [[0 1]
  [2 3]]

Dimensions of our Array...
2

Datatype of our Array object...
int64

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

Result...
 [[-1.]
  [-3.]]

How It Works

When differentiating along axis 1, the method processes each row independently. For the first row [0, 1], representing 0*L_0 + 1*L_1, the derivative gives -1*L_0. For the second row [2, 3], representing 2*L_0 + 3*L_1, the derivative gives -3*L_0.

Multiple Derivatives

You can take higher-order derivatives by setting the m parameter ?

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

c = np.array([[0, 1, 2], [3, 4, 5]])
print("Original coefficients:\n", c)

# Second derivative along axis 1
result = L.lagder(c, m=2, axis=1)
print("\nSecond derivative along axis 1:\n", result)
Original coefficients:
 [[0 1 2]
  [3 4 5]]

Second derivative along axis 1:
 [[2.]
  [2.]]

Conclusion

The lagder() method efficiently differentiates Laguerre series along specified axes. Use axis=1 to differentiate along columns, and adjust m for higher-order derivatives. This is essential for solving differential equations involving Laguerre polynomials.

Updated on: 2026-03-26T20:28:20+05:30

162 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements