Differentiate a Laguerre series, set the derivatives and multiply each differentiation by a scalar in Python

To differentiate a Laguerre series, use the laguerre.lagder() method in Python. The method returns the Laguerre series coefficients c differentiated m times along axis. At each iteration the result is multiplied by scl. The argument c is an array of coefficients from low to high degree along each axis, e.g., [1,2,3] represents the series 1*L_0 + 2*L_1 + 3*L_2 while [[1,2],[1,2]] 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 − An array of Laguerre series coefficients. If c is multidimensional, different axes correspond to different variables.
  • m − Number of derivatives taken, must be non-negative (Default: 1).
  • scl − A scalar. Each differentiation is multiplied by scl. The end result is multiplication by scl**m (Default: 1).
  • axis − Axis over which the derivative is taken (Default: 0).

Example

Let's differentiate a Laguerre series with multiple derivatives and scalar multiplication ?

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

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

# 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 twice with scalar multiplication of -1
print("\nResult (m=2, scl=-1)...")
print(L.lagder(c, 2, scl=-1))
Our Array...
[1 2 3 4]

Dimensions of our Array...
1

Datatype of our Array object...
int64

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

Result (m=2, scl=-1)...
[11.  4.]

Different Scalar Values

Let's see how different scalar values affect the differentiation ?

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

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

# First derivative with different scalars
print("First derivative (m=1):")
print("scl=1:", L.lagder(c, 1, scl=1))
print("scl=2:", L.lagder(c, 1, scl=2))
print("scl=-1:", L.lagder(c, 1, scl=-1))

# Second derivative with different scalars
print("\nSecond derivative (m=2):")
print("scl=1:", L.lagder(c, 2, scl=1))
print("scl=2:", L.lagder(c, 2, scl=2))
First derivative (m=1):
scl=1: [ 1.  2. -1.]
scl=2: [ 2.  4. -2.]
scl=-1: [-1. -2.  1.]

Second derivative (m=2):
scl=1: [-11.  -4.]
scl=2: [-44. -16.]

How It Works

The scalar multiplication works as follows: if you differentiate m times with scalar scl, each differentiation multiplies the result by scl, so the final result is multiplied by scl**m. This is useful for linear changes of variables in polynomial transformations.

Conclusion

Use numpy.polynomial.laguerre.lagder() to differentiate Laguerre series. The scl parameter multiplies each differentiation step, making it useful for variable transformations. Higher-order derivatives require sufficient coefficients in the input array.

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

267 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements