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
Evaluate a Hermite_e series at points x in Python
To evaluate a Hermite_e series at points x, use the hermite_e.hermeval() method in Python NumPy. This function computes the value of a Hermite_e polynomial series at specified points using the provided coefficients.
Syntax
numpy.polynomial.hermite_e.hermeval(x, c, tensor=True)
Parameters
The hermeval() function accepts the following parameters ?
- x: Array of points at which to evaluate the series. Can be a scalar, list, tuple, or ndarray
- c: Array of coefficients ordered so that coefficients for terms of degree n are in c[n]
- tensor: Boolean flag (default True) controlling how multidimensional coefficients are handled
Basic Example
Let's evaluate a simple Hermite_e series with coefficients [1, 2, 3] at point x = 1 ?
import numpy as np
from numpy.polynomial import hermite_e as H
# Create an array of coefficients
c = np.array([1, 2, 3])
print("Coefficients:", c)
# Evaluate at x = 1
result = H.hermeval(1, c)
print("H(1) =", result)
Coefficients: [1 2 3] H(1) = 3.0
Evaluating at Multiple Points
You can evaluate the series at multiple points by passing an array of x values ?
import numpy as np
from numpy.polynomial import hermite_e as H
# Coefficients for the series
c = np.array([1, 2, 3])
# Evaluate at multiple points
x_values = np.array([0, 1, 2, 3])
results = H.hermeval(x_values, c)
print("x values:", x_values)
print("H(x) values:", results)
x values: [0 1 2 3] H(x) values: [ 1. 3. 13. 37.]
How It Works
The Hermite_e polynomial series is evaluated using the formula ?
H(x) = c? + c?·He?(x) + c?·He?(x) + ... + c?·He?(x)
Where He?(x) are the probabilists' Hermite polynomials (Hermite_e polynomials).
Working with Multidimensional Coefficients
The function can handle multidimensional coefficient arrays for evaluating multiple series simultaneously ?
import numpy as np
from numpy.polynomial import hermite_e as H
# Multidimensional coefficients (2 series)
c = np.array([[1, 2], [3, 4], [5, 6]])
print("Coefficient matrix shape:", c.shape)
# Evaluate both series at x = 1
results = H.hermeval(1, c)
print("Results for both series:", results)
Coefficient matrix shape: (3, 2) Results for both series: [ 6. 10.]
Key Points
- Coefficients are ordered by degree: c[0] for degree 0, c[1] for degree 1, etc.
- The function automatically handles scalar and array inputs for x
- Multidimensional coefficient arrays allow evaluation of multiple series
- The tensor parameter controls broadcasting behavior for multidimensional inputs
Conclusion
The hermite_e.hermeval() function provides an efficient way to evaluate Hermite_e polynomial series at specified points. It supports both single and multiple point evaluation with flexible coefficient handling for complex mathematical computations.
