Thursday, October 2, 2025
HomeLanguagesEvaluate Hermite_e series at array of points x in Python

Evaluate Hermite_e series at array of points x in Python

In this article, we will be looking at the approach to evaluate a Hermite_e series at an array of points x in Python.

We are using the hermite.hermeval() function in Python Numpy to evaluate a Hermite e series at point x. The first parameter, x, is transformed to an array if it is a list or tuple; otherwise, it is kept unmodified and handled as a scalar. In any scenario, x or its elements must be able to add and multiply with itself as well as with the elements of c. The second parameter ‘C’ is a coefficient array that is sorted in such a way that the coefficients for the terms of degree n are all stored in ‘c[n]’. The remaining indices enumerate distinct polynomials if c is multidimensional. The coefficients in the two-dimensional situation can be thought of as being stored in the columns of c.

Syntax : np.hermeval(x, series)
Return : Return the evaluated hermite series.

Steps to evaluate the Hermite_e series :

Step 1: Import Numpy and hermite_e libraries :

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

Step 2: Use the hermite.hermeval() function in Python Numpy to evaluate a Hermite_e series at point x as shown below :

x = np.array([[1,2],[3,4]])
print("Result : ",H.hermeval(x,c))

Example 1 : 

In this example, we are creating a coefficient array of 3 data points and a 2-d array assigned to x and further, we are evaluating a Hermite_e series at points x, using the hermite.hermeval() method in Python.

Python3




# importing necessary libraries
import numpy as np
from numpy.polynomial import hermite_e as H
  
# Create an array of coefficients
c = np.array([3, 5, 7])
  
# To evaluate a Hermite_e series at points x, 
# use the hermite.hermeval() method in Python Numpy
x = np.array([[2, 3], [5, 6]])
print("Result : \n", H.hermeval(x, c))


Output : 

Result : 
[[ 34.  74.]
 [196. 278.]]

Example 2 : 

In this example, an array of coefficients is made of 3 points and are evaluating a Hermite_e series at point 1, with the x assigned using the hermite.hermeval() method in Python.

Python3




from numpy.polynomial import hermite_e as H
  
coef = [3, 5, 7]
print("Result 1 : \n",H.hermeval(1, coef))
  
x = [[2, 3], [5, 6]]
print("Result 2 : \n",H.hermeval(x, coef))


Output :

Result 1 : 
 8.0
Result 2 : 
[[ 34.  74.]
 [196. 278.]]
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32331 POSTS0 COMMENTS
Milvus
85 POSTS0 COMMENTS
Nango Kala
6703 POSTS0 COMMENTS
Nicole Veronica
11867 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11926 POSTS0 COMMENTS
Shaida Kate Naidoo
6818 POSTS0 COMMENTS
Ted Musemwa
7079 POSTS0 COMMENTS
Thapelo Manthata
6775 POSTS0 COMMENTS
Umr Jansen
6776 POSTS0 COMMENTS