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 Hermite_e series and multiply each differentiation by a scalar in Python
To differentiate a Hermite_e series and multiply each differentiation by a scalar, use the hermite_e.hermeder() method in Python. This function computes derivatives of Hermite_e series with optional scalar multiplication.
Syntax
numpy.polynomial.hermite_e.hermeder(c, m=1, scl=1, axis=-1)
Parameters
The function takes the following parameters:
- c: Array of Hermite_e 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. Each differentiation is multiplied by this value (Default: 1)
- axis: Axis over which the derivative is taken (Default: -1)
Example
Let's differentiate a Hermite_e series with scalar multiplication ?
import numpy as np
from numpy.polynomial import hermite_e as H
# Create an array of coefficients
coefficients = np.array([1, 2, 3, 4])
# Display the array
print("Our Array...\n", coefficients)
# Check the Dimensions
print("\nDimensions of our Array...\n", coefficients.ndim)
# Get the Datatype
print("\nDatatype of our Array object...\n", coefficients.dtype)
# Get the Shape
print("\nShape of our Array object...\n", coefficients.shape)
# Differentiate the Hermite_e series with scalar multiplication
print("\nResult with scl = -1...\n", H.hermeder(coefficients, 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 with scl = -1... [ -2. -6. -12.]
Multiple Derivatives
You can take multiple derivatives and see the effect of scalar multiplication ?
import numpy as np
from numpy.polynomial import hermite_e as H
coefficients = np.array([1, 2, 3, 4, 5])
print("Original coefficients:", coefficients)
print("First derivative (scl=1):", H.hermeder(coefficients, m=1, scl=1))
print("First derivative (scl=2):", H.hermeder(coefficients, m=1, scl=2))
print("Second derivative (scl=2):", H.hermeder(coefficients, m=2, scl=2))
Original coefficients: [1 2 3 4 5] First derivative (scl=1): [ 2. 6. 12. 20.] First derivative (scl=2): [ 4. 12. 24. 40.] Second derivative (scl=2): [12. 48. 80.]
How It Works
For a Hermite_e polynomial represented by coefficients [c?, c?, c?, ..., c?], the derivative removes the first coefficient and multiplies the remaining ones by their respective indices. The scalar multiplication affects each derivative calculation.
Conclusion
The hermite_e.hermeder() method efficiently computes derivatives of Hermite_e series with scalar multiplication. Use the scl parameter to apply linear transformations during differentiation.
