Differentiate a Hermite_e series with multidimensional coefficients in Python

To differentiate a Hermite_e series with multidimensional coefficients, use the hermite_e.hermeder() method in Python. This method can handle arrays where different axes correspond to different variables.

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. If multidimensional, different axes correspond to different variables
  • m ? Number of derivatives taken, must be non-negative (Default: 1)
  • scl ? Scalar multiplier for each differentiation. Final result is multiplied by scl**m (Default: 1)
  • axis ? Axis over which the derivative is taken (Default: 0)

Example

Let's differentiate a Hermite_e series with a 2D coefficient array:

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...")
print(c)

# Check the dimensions
print("\nDimensions of our Array...")
print(c.ndim)

# Get the datatype
print("\nDatatype of our Array object...")
print(c.dtype)

# Get the shape
print("\nShape of our Array object...")
print(c.shape)

# Differentiate the Hermite_e series
print("\nResult...")
print(H.hermeder(c))
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...
[[2. 3.]]

How It Works

The hermeder() function computes the derivative by:

  1. Taking the derivative along the specified axis (default axis=0)
  2. Reducing the degree by 1 along that axis
  3. Applying the appropriate scaling factors for Hermite_e polynomials

In our example, the original array has shape (2, 2), and after differentiation along axis 0, we get shape (1, 2) as the first row represents the derivative coefficients.

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

# Create a larger coefficient array
c = np.arange(12).reshape(3, 4)
print("Original array shape:", c.shape)

# First derivative
first_deriv = H.hermeder(c, m=1)
print("First derivative shape:", first_deriv.shape)

# Second derivative
second_deriv = H.hermeder(c, m=2)
print("Second derivative shape:", second_deriv.shape)
Original array shape: (3, 4)
First derivative shape: (2, 4)
Second derivative shape: (1, 4)

Conclusion

The hermite_e.hermeder() method efficiently differentiates Hermite_e series with multidimensional coefficients. It reduces the polynomial degree along the specified axis and applies proper scaling factors for accurate differentiation.

Updated on: 2026-03-26T19:37:21+05:30

213 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements