Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Differentiate a Laguerre series 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 differentiated m times along axis. At each iteration, the result is multiplied by a scalar value scl.
The coefficient array c represents coefficients from low to high degree. For example, [1,2,3] represents the series 1*L_0 + 2*L_1 + 3*L_2, where L_n are Laguerre polynomials.
Syntax
numpy.polynomial.laguerre.lagder(c, m=1, scl=1, axis=0)
Parameters
- c ? Array of Laguerre series coefficients
- m ? Number of derivatives taken (default: 1)
- scl ? Scalar multiplier applied to each differentiation (default: 1)
- axis ? Axis over which derivative is taken (default: 0)
Example
Let's differentiate a Laguerre series and multiply by a scalar ?
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 original array
print("Original coefficients:")
print(c)
# Differentiate once with scalar -1
result1 = L.lagder(c, scl=-1)
print("\nFirst derivative (scl=-1):")
print(result1)
# Differentiate twice with scalar 2
result2 = L.lagder(c, m=2, scl=2)
print("\nSecond derivative (scl=2):")
print(result2)
Original coefficients: [1 2 3 4] First derivative (scl=-1): [-2. -4. -4.] Second derivative (scl=2): [-8. -8.]
How It Works
The differentiation process applies the derivative operation to each Laguerre polynomial term and multiplies by the scalar. For multiple derivatives (m > 1), the final result is multiplied by scl^m.
import numpy as np
from numpy.polynomial import laguerre as L
# Example with different scalar values
coeffs = np.array([1, 3, 5])
print("Original coefficients:", coeffs)
print("Derivative (scl=1):", L.lagder(coeffs, scl=1))
print("Derivative (scl=3):", L.lagder(coeffs, scl=3))
print("Second derivative (scl=2):", L.lagder(coeffs, m=2, scl=2))
Original coefficients: [1 3 5] Derivative (scl=1): [-2. 2.] Derivative (scl=3): [-6. 6.] Second derivative (scl=2): [16.]
Conclusion
The laguerre.lagder() method efficiently differentiates Laguerre series and applies scalar multiplication. Use the scl parameter to scale derivatives and m parameter for higher-order derivatives.
