# Convert a polynomial to Hermite_e series using NumPy in Python

Last Updated : 03 Jun, 2022

In this article, we will cover how to convert a polynomial to Hermite_e series using NumPy in Python.

## hermite_e.poly2herme method

We use the hermite_e.poly2herme() function present in the NumPy module of python to convert a polynomial to a Hermite series. Here we need to convert an array of polynomial coefficients, sorted from lowest to the highest degree, to an array of the equivalent Hermite series coefficients, which will be ordered from lowest to the highest degree. The coefficients of the corresponding Hermite series are returned in a 1-dimensional array using this approach. In the example below the polynomial coefficients are stored in the ‘Arr’, which is a 1-dimensional array.

Syntax : numpy.polynomial.hermite_e.poly2herme(pol)

Parameters:

• pol: It is a 1-dimensional array which contains the polynomial coefficients

Return: It returns a 1-dimensional array which contains the coefficients of the equivalent Hermite series.

### Example 1:

We can see in the following examples that by using the hermite_e.poly2herme() method, we can retrieve the coefficients of the hermite_e series from a polynomial.

## Python3

 `# importing numpy and Hermite_e libraries ` `import` `numpy as np ` `from` `numpy.polynomial ``import` `hermite_e  ` ` `  `# Creating an array 'Arr' using the ` `# numpy.array() ` `Arr ``=` `np.array([``4``, ``7``, ``9``, ``10``, ``15``]) ` ` `  `# To convert a polynomial to a Hermite series,  ` `# use the hermite_e.poly2herme() function  ` `# present in Python Numpy module ` `print``(hermite_e.poly2herme(Arr))`

Output :

`[58. 37. 99. 10. 15.]`

### Example 2:

We can see in the following examples that by using the hermite_e.poly2herme() method, we can retrieve the coefficients of the hermite_e series from a polynomial.

## Python3

 `# importing numpy and Hermite_e libraries ` `import` `numpy as np ` `from` `numpy.polynomial ``import` `hermite_e as H  ` ` `  `# Creating an array 'Arr' ` `Arr1 ``=` `[``2``, ``3``, ``5``, ``6``, ``9``] ` ` `  `# To convert a polynomial to a Hermite series,  ` `# use the hermite_e.poly2herme() function ` `# present in Python Numpy module ` `print``(H.poly2herme(Arr1))`

Output :

`[34. 21. 59.  6.  9.]`

Previous
Next