# Differentiate a Laguerre series and set the derivatives 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.

The 1st parameter, c is an array of Laguerre series coefficients. If c is multidimensional the different axis correspond to different variables with the degree in each axis given by the corresponding index. The 2nd parameter, m is the number of derivatives taken, must be non-negative. (Default: 1). The 3rd parameter, scl is a scalar. Each differentiation is multiplied by scl. The end result is multiplication by scl**m. This is for use in a linear change of variable. (Default: 1). The 4th parameter, axis is an Axis over which the derivative is taken. (Default: 0).

## Steps

At first, import the required library −

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...\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 differentiate a Laguerre series, use the laguerre.lagder() method in Python −

print("\nResult...\n",L.lagder(c, 3))

## Example

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...\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 differentiate a Laguerre series, use the laguerre.lagder() method in Python
print("\nResult...\n",L.lagder(c, 3))

## Output

Our Array...
[1 2 3 4]

Dimensions of our Array...
1

Datatype of our Array object...
int64

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

Result...
[-4.]

Updated on: 04-Mar-2022

59 Views