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 series and multiply each differentiation by a scalar in Python
To differentiate a Hermite series, use the hermite.hermder() method in Python. The method allows you to differentiate Hermite series coefficients and multiply each differentiation by a scalar value.
Syntax
hermite.hermder(c, m=1, scl=1, axis=0)
Parameters
The hermder() method accepts the following parameters ?
- c − Array of Hermite 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, resulting in multiplication by scl**m (Default: 1)
- axis − Axis over which the derivative is taken (Default: 0)
Example
Let's differentiate a Hermite series and multiply by a scalar ?
import numpy as np
from numpy.polynomial import hermite as H
# Create an array of coefficients
c = np.array([1, 2, 3, 4])
# Display the array
print("Our Array...")
print(c)
# Check the dimensions and properties
print("\nDimensions of our Array...")
print(c.ndim)
print("\nDatatype of our Array object...")
print(c.dtype)
print("\nShape of our Array object...")
print(c.shape)
# Differentiate Hermite series with scalar multiplication
print("\nResult with scl = -1...")
print(H.hermder(c, 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... [ -4. -12. -24.]
Multiple Derivatives
You can take multiple derivatives by setting the m parameter ?
import numpy as np
from numpy.polynomial import hermite as H
c = np.array([1, 2, 3, 4, 5])
print("Original coefficients:")
print(c)
print("\nFirst derivative (m=1, scl=2):")
print(H.hermder(c, m=1, scl=2))
print("\nSecond derivative (m=2, scl=2):")
print(H.hermder(c, m=2, scl=2))
Original coefficients: [1 2 3 4 5] First derivative (m=1, scl=2): [ 4. 12. 32. 40.] Second derivative (m=2, scl=2): [ 24. 128. 160.]
How It Works
The scalar multiplication affects each derivative level. For m derivatives with scalar scl, the final result is multiplied by scl**m. This is useful for linear changes of variables in differential equations.
Conclusion
Use hermite.hermder() to differentiate Hermite series coefficients. The scl parameter multiplies each differentiation, making it useful for variable transformations in mathematical applications.
