Evaluate a Hermite_e series at multi-dimensional 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 evaluates Hermite_e polynomials at specified points using coefficient arrays.

Syntax

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

Parameters

The function accepts three parameters ?

  • x − Points where the series is evaluated. Can be a scalar, list, tuple, or ndarray
  • c − Array of coefficients where c[n] contains coefficients for degree n terms
  • 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 a 2D array of 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 coefficient array
print("Coefficients:", c)
print("Dimensions:", c.ndim)
print("Shape:", c.shape)

# Create a 2D array of evaluation points
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 polynomial with coefficients [1, 2, 3] represents: 1 + 2*H?(x) + 3*H?(x), where H?(x) = x and H?(x) = x² - 1. For each point in the array, the function computes this polynomial value.

Multi-dimensional Coefficients

You can also work with multi-dimensional coefficient arrays ?

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

# Multi-dimensional coefficients (2 polynomials)
c = np.array([[1, 2], [3, 4], [5, 6]])
print("Coefficient matrix:")
print(c)

# Evaluation points
x = np.array([1, 2])

# Evaluate both polynomials
result = H.hermeval(x, c)
print("\nResult for both polynomials:")
print(result)
Coefficient matrix:
[[1 2]
 [3 4]
 [5 6]]

Result for both polynomials:
[[ 9. 16.]
 [29. 44.]]

Conclusion

The hermite_e.hermeval() function efficiently evaluates Hermite_e series at multiple points. It supports both single and multi-dimensional coefficient arrays, making it versatile for various polynomial evaluation tasks.

Updated on: 2026-03-26T20:57:47+05:30

192 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements