Generate a Hermite_e series with given complex roots in Python

To generate a Hermite_e series with given complex roots, use the hermite_e.hermefromroots() method in Python NumPy. The method returns a 1-D array of coefficients representing the polynomial with the specified roots.

If all roots are real, the output is a real array. If some roots are complex, the output is complex even if all coefficients in the result are real. The parameter roots accepts a sequence containing the desired roots.

Syntax

hermite_e.hermefromroots(roots)

Parameters:

  • roots − Sequence of roots to use in generating the series

Returns: 1-D array of Hermite_e series coefficients ordered from low to high degree.

Example

Let's generate a Hermite_e series with complex roots and examine its properties ?

from numpy.polynomial import hermite_e as H

# Create complex roots
j = complex(0, 1)
roots = (-j, j)

# Generate Hermite_e series from complex roots
result = H.hermefromroots(roots)
print("Result:")
print(result)

# Get the datatype
print("\nType:")
print(result.dtype)

# Get the shape
print("\nShape:")
print(result.shape)
Result:
[2.+0.j 0.+0.j 1.+0.j]

Type:
complex128

Shape:
(3,)

How It Works

The function constructs a polynomial in Hermite_e form where the given complex numbers are the roots. In this example, the roots are -j and j (where j is the imaginary unit), resulting in the polynomial coefficients [2+0j, 0+0j, 1+0j].

The output array represents the coefficients of the Hermite_e polynomial ordered from low to high degree, where the polynomial has the specified complex roots.

Conclusion

The hermefromroots() method efficiently generates Hermite_e series coefficients from given complex roots. The resulting array's datatype depends on whether the roots are real or complex.

Updated on: 2026-03-26T21:17:15+05:30

206 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements