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 with multidimensional coefficients over axis 1 in Python
To differentiate a Hermite_e series with multidimensional coefficients, use the hermite_e.hermeder() method in Python. This method allows you to compute derivatives across specific axes of multidimensional coefficient arrays.
Parameters
The hermite_e.hermeder() method accepts the following parameters:
- c: Array of Hermite_e series coefficients. For multidimensional arrays, different axes correspond to different variables
- m: Number of derivatives (default: 1). Must be non-negative
- scl: Scalar multiplier applied to each differentiation (default: 1)
- axis: Axis over which the derivative is taken (default: 0)
Example: Differentiating Along Axis 1
Let's create a multidimensional coefficient array and differentiate along axis 1 ?
import numpy as np
from numpy.polynomial import hermite_e as H
# Create a multidimensional array of coefficients
c = np.arange(4).reshape(2, 2)
# 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)
# Differentiate along axis 1
print("\nResult...\n", H.hermeder(c, axis=1))
Our Array... [[0 1] [2 3]] Dimensions of our Array... 2 Datatype of our Array object... int64 Shape of our Array object... (2, 2) Result... [[1.] [3.]]
How It Works
When differentiating along axis 1, the method takes the derivative of each row independently. The original coefficient matrix has shape (2, 2), and after differentiation, we get a (2, 1) result. Each element in the result represents the derivative coefficient for the corresponding polynomial.
Multiple Derivatives
You can compute higher-order derivatives by specifying the m parameter ?
import numpy as np
from numpy.polynomial import hermite_e as H
c = np.arange(6).reshape(2, 3)
print("Original coefficients:\n", c)
# First derivative along axis 1
result1 = H.hermeder(c, m=1, axis=1)
print("\nFirst derivative:\n", result1)
# Second derivative along axis 1
result2 = H.hermeder(c, m=2, axis=1)
print("\nSecond derivative:\n", result2)
Original coefficients: [[0 1 2] [3 4 5]] First derivative: [[1. 4.] [4. 10.]] Second derivative: [[4.] [10.]]
Conclusion
The hermite_e.hermeder() method provides flexible differentiation of Hermite_e series along specified axes. Use axis=1 to differentiate across columns, which is useful for multivariable polynomial operations.
