Evaluate a Hermite_e series at list of points x in Python

To evaluate a Hermite_e series at points x, use the hermite_e.hermeval() method in NumPy. This function evaluates the polynomial series at given points using the coefficients provided.

Syntax

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

Parameters

The function accepts the following parameters ?

  • x ? If x is a list or tuple, it is converted to an ndarray, otherwise it is left unchanged and treated as a scalar. The elements must support addition and multiplication with themselves and with the elements of c.
  • c ? An array of coefficients ordered so that the coefficients for terms of degree n are contained in c[n]. If c is multidimensional, the remaining indices enumerate multiple polynomials.
  • tensor ? If True (default), the shape of the coefficient array is extended with ones on the right. If False, x is broadcast over the columns of c for the evaluation.

Example

Let's create a complete example to evaluate a Hermite_e series at multiple 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("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)

# Here, x is a list of points where we want to evaluate
x = [5, 10, 15]

# To evaluate a Hermite_e series at points x, use the hermeval() method
print("\nResult...")
print(H.hermeval(x, c))
Our Array...
[1 2 3]

Dimensions of our Array...
1

Datatype of our Array object...
int64

Shape of our Array object...
(3,)

Result...
[ 83. 318. 703.]

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 normalized Hermite polynomials. For our coefficients [1, 2, 3] and points [5, 10, 15], the function computes the polynomial values at each point.

Example with Single Point

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

# Coefficients for the series
coeffs = np.array([1, 2, 3, 4])

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

# Evaluate at multiple points
points = [1, 2, 3]
results = H.hermeval(points, coeffs)
print(f"Results at multiple points: {results}")
Result at x=2: 45.0
Results at multiple points: [10. 45. 128.]

Conclusion

The hermite_e.hermeval() function efficiently evaluates Hermite_e polynomial series at given points. It accepts both single values and arrays of points, making it versatile for mathematical computations involving normalized Hermite polynomials.

Updated on: 2026-03-26T20:48:25+05:30

205 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements