Differentiate a Hermite_e series with multidimensional coefficients over specific axis 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 along specific axes of multidimensional coefficient arrays.

Syntax

numpy.polynomial.hermite_e.hermeder(c, m=1, scl=1, axis=0)

Parameters

The 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 taken (default: 1). Must be non-negative
  • scl − Scalar multiplier for each differentiation (default: 1). Final result is multiplied by scl**m
  • axis − Axis over which the derivative is taken (default: 0)

Example

Let's create a multidimensional coefficient array and differentiate along different axes ?

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 (axis=1)...\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 (axis=1)...
 [[1.]
 [3.]]

Differentiation Along Different Axes

You can differentiate along different axes to see how the operation affects the coefficient matrix ?

import numpy as np
from numpy.polynomial import hermite_e as H

# Create a 3x3 coefficient matrix
c = np.arange(9).reshape(3, 3)
print("Original coefficients:")
print(c)

# Differentiate along axis 0 (default)
print("\nDerivative along axis 0:")
print(H.hermeder(c, axis=0))

# Differentiate along axis 1
print("\nDerivative along axis 1:")
print(H.hermeder(c, axis=1))
Original coefficients:
[[0 1 2]
 [3 4 5]
 [6 7 8]]

Derivative along axis 0:
[[3. 4. 5.]
 [12. 14. 16.]]

Derivative along axis 1:
[[1. 4.]
 [4. 10.]
 [7. 16.]]

Higher Order Derivatives

You can compute higher order derivatives by specifying the m parameter ?

import numpy as np
from numpy.polynomial import hermite_e as H

# Create coefficient array
c = np.array([[1, 2, 3, 4], [5, 6, 7, 8]])
print("Original coefficients:")
print(c)

# First derivative
print("\nFirst derivative (m=1):")
print(H.hermeder(c, m=1, axis=1))

# Second derivative
print("\nSecond derivative (m=2):")
print(H.hermeder(c, m=2, axis=1))
Original coefficients:
[[1 2 3 4]
 [5 6 7 8]]

First derivative (m=1):
[[2. 6. 12.]
 [6. 14. 24.]]

Second derivative (m=2):
[[6. 24.]
 [14. 48.]]

Conclusion

The hermite_e.hermeder() method efficiently differentiates Hermite_e series with multidimensional coefficients along specified axes. Use the axis parameter to control the differentiation direction and m for higher-order derivatives.

Updated on: 2026-03-26T19:43:02+05:30

194 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements