Differentiate a Laguerre series with multidimensional coefficients in Python

To differentiate a Laguerre series with multidimensional coefficients, use the laguerre.lagder() method in Python. The method returns the Laguerre series coefficients differentiated m times along a specified axis. At each iteration, the result is multiplied by a scaling factor.

The coefficient array c represents Laguerre polynomial terms where [1,2,3] represents 1*L_0 + 2*L_1 + 3*L_2. For multidimensional arrays like [[1,2],[1,2]], it represents 1*L_0(x)*L_0(y) + 1*L_1(x)*L_0(y) + 2*L_0(x)*L_1(y) + 2*L_1(x)*L_1(y) if axis=0 is x and axis=1 is y.

Parameters

The lagder() method accepts the following parameters ?

  • c ? Array of Laguerre series coefficients. For multidimensional arrays, different axes correspond to different variables
  • m ? Number of derivatives taken, must be non-negative (Default: 1)
  • scl ? Scalar multiplier applied at each differentiation step (Default: 1)
  • axis ? Axis over which the derivative is taken (Default: 0)

Example

Let's differentiate a Laguerre series with a 2D coefficient array ?

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...")
print(c)

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

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

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

# Differentiate the Laguerre series
print("\nResult...")
print(L.lagder(c))
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...
[[-2. -3.]]

Differentiation Along Different Axes

You can specify which axis to differentiate along using the axis parameter ?

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

# Create a 3x3 coefficient array
c = np.arange(9).reshape(3,3)
print("Original coefficients:")
print(c)

# Differentiate along axis 0 (default)
print("\nDifferentiation along axis 0:")
print(L.lagder(c, axis=0))

# Differentiate along axis 1
print("\nDifferentiation along axis 1:")
print(L.lagder(c, axis=1))
Original coefficients:
[[0 1 2]
 [3 4 5]
 [6 7 8]]

Differentiation along axis 0:
[[-3. -3. -3.]
 [-3. -3. -3.]]

Differentiation along axis 1:
[[-1. -1.]
 [-1. -1.]
 [-1. -1.]]

Multiple Derivatives

Use the m parameter to take higher-order derivatives ?

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

# Create coefficient array
c = np.array([1, 2, 3, 4])

print("Original coefficients:", c)
print("First derivative:", L.lagder(c, m=1))
print("Second derivative:", L.lagder(c, m=2))
print("Third derivative:", L.lagder(c, m=3))
Original coefficients: [1 2 3 4]
First derivative: [-1. -1. -1.]
Second derivative: [ 2.  2.]
Third derivative: [-6.]

Conclusion

The laguerre.lagder() method efficiently differentiates Laguerre series with multidimensional coefficients. Use the axis parameter to control differentiation direction and m parameter for higher-order derivatives.

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

180 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements