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
Multiply one Hermite series to another in Python
To multiply one Hermite series to another, use the polynomial.hermite.hermmul() method in Python NumPy. This method returns an array representing the Hermite series of their product. The arguments are sequences of coefficients ordered from lowest to highest degree, e.g., [1,2,3] represents the series P_0 + 2*P_1 + 3*P_2.
Syntax
numpy.polynomial.hermite.hermmul(c1, c2)
Parameters
c1, c2: 1-D arrays of Hermite series coefficients ordered from low to high degree.
Return Value
Returns a 1-D array representing the coefficients of the product Hermite series.
Example
Let's multiply two Hermite series using coefficient arrays ?
import numpy as np
from numpy.polynomial import hermite as H
# Create 1-D arrays of Hermite series coefficients
c1 = np.array([1, 2, 3])
c2 = np.array([3, 2, 1])
# Display the arrays of coefficients
print("Array1:", c1)
print("Array2:", c2)
# Display array properties
print("\nArray1 datatype:", c1.dtype)
print("Array2 datatype:", c2.dtype)
print("\nDimensions of Array1:", c1.ndim)
print("Dimensions of Array2:", c2.ndim)
print("\nShape of Array1:", c1.shape)
print("Shape of Array2:", c2.shape)
# Multiply the Hermite series
result = H.hermmul(c1, c2)
print("\nResult (multiply):", result)
Array1: [1 2 3] Array2: [3 2 1] Array1 datatype: int64 Array2 datatype: int64 Dimensions of Array1: 1 Dimensions of Array2: 1 Shape of Array1: (3,) Shape of Array2: (3,) Result (multiply): [35. 40. 38. 8. 3.]
How It Works
The hermmul() function performs multiplication of two Hermite polynomial series by:
- Taking coefficient arrays representing two Hermite series
- Computing the product according to Hermite polynomial multiplication rules
- Returning the coefficients of the resulting product series
The resulting array has a degree equal to the sum of the input series degrees, which is why our result has 5 coefficients (degree 4) from multiplying two degree-2 series.
Conclusion
Use numpy.polynomial.hermite.hermmul() to multiply Hermite polynomial series efficiently. The function handles the complex multiplication rules automatically and returns the coefficient array of the product series.
