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

Convert a polynomial to a Hermite_e series in Python

WBOY
Release: 2023-09-08 08:25:02
forward
1200 people have browsed it

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
Copy after login

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

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

Display array−

print("Our Array...\n",c)
Copy after login

Check size−

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

Get data type−

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

Get shape−

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

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))
Copy after login

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))
Copy after login

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.]
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template