Differentiate a Hermite series and set the derivatives in Python

To differentiate a Hermite series, use the hermite.hermder() method in Python. This function computes the derivative of a Hermite series representation of a polynomial.

Syntax

numpy.polynomial.hermite.hermder(c, m=1, scl=1, axis=0)

Parameters

The hermder() method accepts the following parameters:

  • c − Array of Hermite 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)

Basic Example

Let's create a Hermite series and compute its first derivative ?

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

# Create an array of coefficients
c = np.array([1, 2, 3, 4])

print("Original coefficients:", c)
print("First derivative:", H.hermder(c))
Original coefficients: [1 2 3 4]
First derivative: [ 4. 12. 48.]

Multiple Derivatives

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

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

c = np.array([1, 2, 3, 4])

print("Original coefficients:", c)
print("Second derivative:", H.hermder(c, m=2))
print("Third derivative:", H.hermder(c, m=3))
Original coefficients: [1 2 3 4]
Second derivative: [ 24. 192.]
Third derivative: [384.]

Using Scalar Multiplier

The scl parameter scales each differentiation step ?

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

c = np.array([1, 2, 3, 4])

print("First derivative (scl=1):", H.hermder(c, scl=1))
print("First derivative (scl=2):", H.hermder(c, scl=2))
print("Second derivative (scl=2):", H.hermder(c, m=2, scl=2))
First derivative (scl=1): [ 4. 12. 48.]
First derivative (scl=2): [ 8. 24. 96.]
Second derivative (scl=2): [ 96. 768.]

Complete Example with Array Properties

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

# Create an array of coefficients
c = np.array([1, 2, 3, 4])

# Display array properties
print("Our Array...\n", c)
print("\nDimensions of our Array...\n", c.ndim)
print("\nDatatype of our Array object...\n", c.dtype)
print("\nShape of our Array object...\n", c.shape)

# Compute third derivative
print("\nThird derivative result...\n", H.hermder(c, 3))
Our Array...
 [1 2 3 4]

Dimensions of our Array...
1

Datatype of our Array object...
int64

Shape of our Array object...
(4,)

Third derivative result...
 [384.]

Conclusion

The hermite.hermder() method efficiently computes derivatives of Hermite series. Use the m parameter for higher-order derivatives and scl for linear transformations. The function returns coefficients representing the derivative as another Hermite series.

Updated on: 2026-03-26T20:05:43+05:30

213 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements