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 a Hermite_e series by an independent variable in Python
To multiply a Hermite_e series by the independent variable x, use the hermemulx() method from NumPy's polynomial module. This method takes a 1-D array of Hermite_e series coefficients and returns the result of multiplying the series by x.
Syntax
numpy.polynomial.hermite_e.hermemulx(c)
Parameters
- c − 1-D array of Hermite_e series coefficients ordered from low to high degree
Return Value
Returns an array representing the Hermite_e series multiplied by x.
Example
Let's create a Hermite_e series and multiply it by the independent variable ?
import numpy as np
from numpy.polynomial import hermite_e as H
# Create coefficient array for Hermite_e series
c = np.array([1, 2, 3])
# Display the array
print("Coefficients:", c)
print("Dimensions:", c.ndim)
print("Datatype:", c.dtype)
print("Shape:", c.shape)
# Multiply the Hermite_e series by x
result = H.hermemulx(c)
print("\nResult after multiplying by x:", result)
Coefficients: [1 2 3] Dimensions: 1 Datatype: int64 Shape: (3,) Result after multiplying by x: [2. 7. 2. 3.]
How It Works
The hermemulx() method implements the mathematical operation of multiplying a Hermite_e polynomial by its independent variable. For a Hermite_e series with coefficients [1, 2, 3], representing the polynomial 1*He_0(x) + 2*He_1(x) + 3*He_2(x), multiplying by x transforms the coefficients according to Hermite_e polynomial properties.
Multiple Coefficients Example
Here's an example with different coefficient arrays ?
import numpy as np
from numpy.polynomial import hermite_e as H
# Test with different coefficient arrays
coeff_arrays = [
np.array([1]),
np.array([1, 1]),
np.array([1, 2, 3, 4])
]
for i, coeffs in enumerate(coeff_arrays):
result = H.hermemulx(coeffs)
print(f"Input {i+1}: {coeffs}")
print(f"Output {i+1}: {result}")
print()
Input 1: [1] Output 1: [1. 0.] Input 2: [1 1] Output 2: [1. 1. 1.] Input 3: [1 2 3 4] Output 3: [2. 9. 2. 3. 4.]
Conclusion
The hermemulx() method efficiently multiplies Hermite_e series by the independent variable x. This operation is useful in polynomial mathematics and scientific computing applications involving Hermite_e polynomials.
