Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Convert a polynomial to Hermite_e series in Python
To convert a polynomial to a Hermite_e series, use the hermite_e.poly2herme() method in Python NumPy. This function converts an array representing polynomial coefficients (ordered from lowest to highest degree) to an array of coefficients for the equivalent Hermite_e series.
Syntax
numpy.polynomial.hermite_e.poly2herme(pol)
Parameters
The pol parameter is a 1-D array containing the polynomial coefficients ordered from lowest degree to highest degree.
Example
Let's convert a polynomial with coefficients [1, 2, 3, 4, 5] to its equivalent Hermite_e series ?
import numpy as np
from numpy.polynomial import hermite_e as H
# Create an array representing polynomial coefficients
coeffs = np.array([1, 2, 3, 4, 5])
# Display the polynomial coefficients
print("Polynomial coefficients:", coeffs)
print("Dimensions:", coeffs.ndim)
print("Shape:", coeffs.shape)
print("Datatype:", coeffs.dtype)
# Convert polynomial to Hermite_e series
hermite_coeffs = H.poly2herme(coeffs)
print("\nHermite_e series coefficients:", hermite_coeffs)
Polynomial coefficients: [1 2 3 4 5] Dimensions: 1 Shape: (5,) Datatype: int64 Hermite_e series coefficients: [19. 14. 33. 4. 5.]
How It Works
The polynomial 1 + 2x + 3x² + 4x³ + 5x? is converted to its equivalent representation using Hermite_e polynomials. The resulting coefficients [19, 14, 33, 4, 5] represent the same mathematical function expressed in the Hermite_e basis.
Conclusion
The hermite_e.poly2herme() method efficiently converts polynomial coefficients to their Hermite_e series representation. This conversion is useful in numerical analysis and mathematical computations involving orthogonal polynomials.
