Divide one Hermite_e series by another in Python

To divide one Hermite_e series by another, use the polynomial.hermite_e.hermediv() method in Python NumPy. The method returns a tuple containing the quotient and remainder as arrays of Hermite_e series coefficients.

The method performs polynomial long division on two Hermite_e series c1 / c2, where the arguments are sequences of coefficients from lowest order "term" to highest. For example, [1,2,3] represents the series P_0 + 2*P_1 + 3*P_2.

Syntax

numpy.polynomial.hermite_e.hermediv(c1, c2)

Parameters

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

Return Value

Returns a tuple (quotient, remainder) where both are 1-D arrays of Hermite_e series coefficients.

Example

Let's divide two Hermite_e series and examine the result ?

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

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

# Display the arrays of coefficients
print("Array1...\n", c1)
print("\nArray2...\n", c2)

# Display the datatype
print("\nArray1 datatype...\n", c1.dtype)
print("\nArray2 datatype...\n", c2.dtype)

# Check the Dimensions of both the arrays
print("\nDimensions of Array1...\n", c1.ndim)
print("\nDimensions of Array2...\n", c2.ndim)

# Check the Shape of both the arrays
print("\nShape of Array1...\n", c1.shape)
print("\nShape of Array2...\n", c2.shape)

# To divide one Hermite_e series by another, use the polynomial.hermite_e.hermediv() method
print("\nResult (division)....\n", H.hermediv(c1, c2))
Array1...
 [53. 30. 52.  7.  6.]

Array2...
 [1 2 3]

Array1 datatype...
 float64

Array2 datatype...
 int64

Dimensions of Array1...
 1

Dimensions of Array2...
 1

Shape of Array1...
 (5,)

Shape of Array2...
 (3,)

Result (division)....
 (array([8., 1., 2.]), array([31., -1.]))

Understanding the Result

The output shows a tuple with two arrays:

  • Quotient: [8., 1., 2.] represents 8*P_0 + 1*P_1 + 2*P_2
  • Remainder: [31., -1.] represents 31*P_0 + (-1)*P_1

Conclusion

The hermediv() method performs polynomial long division on Hermite_e series, returning both quotient and remainder. This is useful for polynomial arithmetic operations in scientific computing applications.

Updated on: 2026-03-26T21:10:05+05:30

200 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements