Evaluate a Hermite_e series at array of 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 given points using the provided coefficients.

Syntax

numpy.polynomial.hermite_e.hermeval(x, c, tensor=True)

Parameters

The function accepts the following parameters ?

  • x − Array of points where the series is evaluated. Can be scalar, list, or ndarray
  • c − Array of coefficients ordered so that coefficients for degree n are in c[n]
  • tensor − If True (default), evaluates every column of coefficients for every element of x

Example

Let's evaluate a Hermite_e series with coefficients [1, 2, 3] at various points ?

import numpy as np
from numpy.polynomial import hermite_e as H

# Create an array of coefficients
c = np.array([1, 2, 3])

# Display the array
print("Coefficients:", c)
print("Dimensions:", c.ndim)
print("Shape:", c.shape)

# Evaluate at points x
x = np.array([[1, 2], [3, 4]])
print("\nEvaluation points:")
print(x)

# Evaluate the Hermite_e series
result = H.hermeval(x, c)
print("\nResult:")
print(result)
Coefficients: [1 2 3]
Dimensions: 1
Shape: (3,)

Evaluation points:
[[1 2]
 [3 4]]

Result:
[[ 3. 14.]
 [31. 54.]]

How It Works

The Hermite_e series is evaluated using the formula: c[0] + c[1]*He_1(x) + c[2]*He_2(x) + ... where He_n(x) are the Hermite_e polynomials. For our example with coefficients [1, 2, 3], the series becomes: 1 + 2*He_1(x) + 3*He_2(x).

Single Point Evaluation

import numpy as np
from numpy.polynomial import hermite_e as H

# Coefficients [1, 2, 3]
c = np.array([1, 2, 3])

# Evaluate at a single point
x = 2
result = H.hermeval(x, c)
print(f"Value at x={x}: {result}")

# Evaluate at multiple points
x_points = [0, 1, 2, 3]
results = H.hermeval(x_points, c)
print(f"Values at {x_points}: {results}")
Value at x=2: 14.0
Values at [0, 1, 2, 3]: [ 1.  3. 14. 31.]

Conclusion

The hermite_e.hermeval() function efficiently evaluates Hermite_e polynomial series at given points using coefficient arrays. It supports both scalar and array inputs for flexible mathematical computations.

Updated on: 2026-03-26T20:51:58+05:30

202 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements