Home  >  Article  >  Backend Development  >  Convert a polynomial to a Hermite_e series in Python

Convert a polynomial to a Hermite_e series in Python

WBOY
WBOYforward
2023-09-08 08:25:021180browse

Convert a polynomial to a Hermite_e series in Python

To convert a polynomial to a Hermite series, use the hermite_e.poly2herme() method in Python

Numpy. Convert an array representing the coefficients of a polynomial ordered from lowest degree to the highest point, to the coefficient array of the equivalent Hermite series, sorted from low to high Maximum number of times. This method returns a one-dimensional array containing the equivalent coefficients Hermite series. The parameter pol is a 1-D array containing polynomial coefficients

Steps

First, import the required library −

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

Create an array using the numpy.array() method −

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

Display array−

print("Our Array...\n",c)

Check size−

print("\nDimensions of our Array...\n",c.ndim)

Get data type−

print("\nDatatype of our Array object...\n",c.dtype)

Get shape−

print("\nShape of our Array object...\n",c.shape)

To To convert a polynomial to a Hermite series, use the hermite_e.poly2herme() method in Python

Numpy. Convert an array representing the coefficients of a polynomial ordered from lowest degree to the highest point, to the coefficient array of the equivalent Hermite series, sorted from low to high Highest degree −
print("\nResult (polynomial to hermite_e)...\n",H.poly2herme(c))

Example

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

# Create an array using the numpy.array() method
c = np.array([1, 2, 3, 4, 5])

# Display the array
print("Our Array...\n",c)

# Check the Dimensions
print("\nDimensions of our Array...\n",c.ndim)

# Get the Datatype
print("\nDatatype of our Array object...\n",c.dtype)

# Get the Shape
print("\nShape of our Array object...\n",c.shape)

# To convert a polynomial to a Hermite series, use the hermite_e.poly2herme() method in Python Numpy
print("\nResult (polynomial to hermite_e)...\n",H.poly2herme(c))

Output

Our Array...
   [1 2 3 4 5]

Dimensions of our Array...
1

Datatype of our Array object...
int64

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

Result (polynomial to hermite_e)...
   [19. 14. 33. 4. 5.]

The above is the detailed content of Convert a polynomial to a Hermite_e series in Python. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete