Open In App

Evaluate a Hermite_e series at list of points x using NumPy in Python

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Share
Report issue
Report

In this article, we will be looking toward the approach to evaluating a Hermite_e series at a list of points x using Python and NumPy.

Example:

List: [6,7,8,9,10]
Result: [102175. 191631. 329175. 529399. 808815.]
Explanation: Hermite_e series at points x.

NumPy.polynomial.hermite_e.hermeval() method

To evaluate a Hermite_e series at a tuple of points x we need to call the hermite_e.hermeval() method of the Numpy library in Python. this method takes two parameters, the first parameter is the x, where x is a list or tuple, and the 2nd parameter is C,  which is an array of coefficients. This method returns the coefficient of series after multiplication.

Syntax : np.polynomial.hermite_e.hermeval(x, c)

Parameter:

  • x: list or tuple
  • c: array of coefficient

Return : Return the coefficient of series after multiplication.

Example 1:

In this example, we created an array of 5 data points of one dimension and further created a list named x, then with the use of the hermite_e.hermeval() method, and pass the required parameters to evaluate the Hermite_e series at a list at points [6,7,8,9,10] in Python.

Python3




import numpy as np
from numpy.polynomial import hermite_e
  
a = np.array([1, 2, 3, 4, 5])
  
# Dimensions of Array
print("Dimensions of Array: ", a.ndim)
  
# Shape of the array
print("\nShape of Array: ", a.shape)
  
# List
x = [6, 7, 8, 9, 10]
  
# To evaluate a Hermite_e series at points x
print("\nHermite series at point", hermite_e.hermeval(x, a))


Output:

Dimensions of Array:  1

Shape of Array:  (5,)

Hermite series at point [ 6325. 11997. 20733. 33457. 51213.]

Example 2:

In this example, we created a 2-D array of 10 data points and further created a list name x, then with the use of the hermite_e.hermeval() method, and pass the required parameters to evaluate the Hermite_e series at a list at points (11,12,13,14,15) in Python.

Python3




import numpy as np
from numpy.polynomial import hermite_e
  
a = np.array([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]])
  
# Dimensions of Array
print("Dimensions of Array: ", a.ndim)
  
# Shape of the array
print("\nShape of Array: ", a.shape)
  
# list
x = [11, 12, 13, 14, 15]
  
# To evaluate a Hermite_e series at points x
print("\nHermite series at point", hermite_e.hermeval(x, a))


Output:

Dimensions of Array:  2

Shape of Array:  (2, 5)

Hermite series at point [[ 67.  73.  79.  85.  91.]

 [ 79.  86.  93. 100. 107.]

 [ 91.  99. 107. 115. 123.]

 [103. 112. 121. 130. 139.]

 [115. 125. 135. 145. 155.]]



Last Updated : 03 Jun, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads