Divide one Hermite series by another in Python

To divide one Hermite series by another, use the polynomial.hermite.hermdiv() method in Python NumPy. The method returns a tuple containing two arrays: the quotient and remainder of the division. The arguments are sequences of coefficients from lowest order "term" to highest, e.g., [1,2,3] represents the series P_0 + 2*P_1 + 3*P_2.

Syntax

numpy.polynomial.hermite.hermdiv(c1, c2)

Parameters:

  • c1, c2: 1-D arrays of Hermite series coefficients ordered from low to high degree

Returns: A tuple (quotient, remainder) where both are arrays of Hermite series coefficients.

Example

Let's divide two Hermite series and examine the quotient and remainder ?

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

# Create 1-D arrays of Hermite series coefficients
c1 = np.array([53., 30., 52., 7., 6.])
c2 = np.array([1, 2, 3])

print("Dividend (c1):", c1)
print("Divisor (c2):", c2)

# Perform Hermite series division
quotient, remainder = H.hermdiv(c1, c2)

print("\nQuotient:", quotient)
print("Remainder:", remainder)
print("\nComplete result:", H.hermdiv(c1, c2))
Dividend (c1): [53. 30. 52.  7.  6.]
Divisor (c2): [1 2 3]

Quotient: [0. 1. 2.]
Remainder: [1. 1.]

Complete result: (array([0., 1., 2.]), array([1., 1.]))

Understanding the Result

The division returns a tuple where:

  • The quotient [0., 1., 2.] represents the Hermite series: 0*P_0 + 1*P_1 + 2*P_2
  • The remainder [1., 1.] represents the Hermite series: 1*P_0 + 1*P_1

This follows the polynomial division property: dividend = divisor × quotient + remainder.

Verification Example

Let's verify the division by reconstructing the dividend ?

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

c1 = np.array([53., 30., 52., 7., 6.])
c2 = np.array([1, 2, 3])

quotient, remainder = H.hermdiv(c1, c2)

# Verify: c1 should equal (c2 * quotient) + remainder
product = H.hermmul(c2, quotient)
reconstructed = H.hermadd(product, remainder)

print("Original dividend:", c1)
print("Reconstructed dividend:", reconstructed)
print("Are they equal?", np.allclose(c1, reconstructed))
Original dividend: [53. 30. 52.  7.  6.]
Reconstructed dividend: [53. 30. 52.  7.  6.]
Are they equal? True

Conclusion

The hermdiv() function performs polynomial long division on Hermite series, returning both quotient and remainder. This is useful for polynomial arithmetic and simplifying complex Hermite series expressions.

Updated on: 2026-03-26T19:51:51+05:30

167 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements