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 series by an independent variable in Python
To multiply the Hermite series by x, where x is the independent variable, use the polynomial.hermite.hermmulx() method in Python NumPy. The method returns an array representing the result of the multiplication. The parameter c is a 1-D array of Hermite series coefficients ordered from low to high.
Syntax
numpy.polynomial.hermite.hermmulx(c)
Parameters
c: A 1-D array of Hermite series coefficients ordered from low to high degree.
Example
Let's create a simple example to demonstrate the multiplication of a Hermite series by the independent variable ?
import numpy as np
from numpy.polynomial import hermite as H
# Create an array of Hermite series coefficients
c = np.array([1, 2, 3])
# Display the array
print("Our Array...")
print(c)
# Check the Dimensions
print("\nDimensions of our Array...")
print(c.ndim)
# Get the Datatype
print("\nDatatype of our Array object...")
print(c.dtype)
# Get the Shape
print("\nShape of our Array object...")
print(c.shape)
# Multiply the Hermite series by x
result = H.hermmulx(c)
print("\nResult after multiplication by x...")
print(result)
Our Array... [1 2 3] Dimensions of our Array... 1 Datatype of our Array object... int64 Shape of our Array object... (3,) Result after multiplication by x... [2. 6.5 1. 1.5]
How It Works
The hermmulx() function multiplies each term of the Hermite series by the independent variable x. For a Hermite series represented as c[0]*H?(x) + c[1]*H?(x) + c[2]*H?(x), multiplication by x transforms it according to Hermite polynomial recurrence relations.
Multiple Coefficient Example
Here's another example with different coefficients ?
import numpy as np
from numpy.polynomial import hermite as H
# Create arrays with different coefficients
coeffs1 = np.array([5, 0, 2])
coeffs2 = np.array([1, 1, 1, 1])
print("Original coefficients [5, 0, 2]:")
print("Result after x multiplication:", H.hermmulx(coeffs1))
print("\nOriginal coefficients [1, 1, 1, 1]:")
print("Result after x multiplication:", H.hermmulx(coeffs2))
Original coefficients [5, 0, 2]: Result after x multiplication: [0. 12.5 0. 1. ] Original coefficients [1, 1, 1, 1]: Result after x multiplication: [1. 2.5 1.5 0.5 0.5]
Conclusion
The hermmulx() method efficiently multiplies Hermite series by the independent variable x using polynomial recurrence relations. It's essential for manipulating Hermite polynomials in numerical computations and mathematical modeling.
