Thursday, September 4, 2025
HomeLanguagesEvaluate a Hermite series at points x broadcast over the columns of...

Evaluate a Hermite series at points x broadcast over the columns of the coefficient in Python

In this article, we will be looking toward the approach to evaluating a Hermite series at points x broadcast over the columns of the coefficient in Python and NumPy.

Example:

Array: [1,2,3,4,5],[6,7,8,9,10]]

Result: [ 73. 100. 131. 166. 205.]

Explanation: Hermite series at points x broadcast over the columns 

Numpy np.hermeval() method

To evaluate a Hermite series at a tuple of points x broadcast over the columns of the coefficient, the user needs to call the hermite.hermval() method of the Numpy library in Python. Further, the user needs to pass the first parameter to the function which is the x, where x is a list or tuple, the 2nd parameter is C,  which is an array of coefficients, and the 3rd parameter tensor, if True, the shape of the coefficient array is extended with ones on the right, one for each dimension of x.

Syntax : np.hermeval(x, series,tensor)

Parameter:

  • x: list or tuple
  • series: array of coefficient
  •  tensor, if True, the shape of the coefficient array is extended with ones on the right, one for each dimension of x. Scalars have dimension 0 for this action. 

Return : Return the evaluated hermite series.

Example:

In this example, we created a 2-D array of 10 data points and further created a tuple name x., then with the use of the hermite.hermeval() method we pass the required parameters with tensor set to false to evaluate the Hermite series at points x broadcast over the columns in Python.

Python3




import numpy as np
from numpy.polynomial import hermite
  
a = np.array([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]])
  
# Dimensions of Array
print("\nDimensions of Array:\n", a.ndim)
  
# Shape of the array
print("\nShape of Array:\n", a.shape)
  
# Tuple
x = [6, 7, 8, 9, 10]
  
# To evaluate a Hermite series at 
# points x broadcast over the columns
hermite.hermval(x, a, tensor=False)


Output:

Dimensions of Array:
 2

Shape of Array:
 (2, 5)

array([ 73., 100., 131., 166., 205.])

Example:

In this example, we created a 2-D array of 10 data points and further created a tuple name x., then with the use of the hermite.hermeval() method we pass the required parameters with tensor set to true to evaluate the Hermite series at points x broadcast over the columns in Python.

Python3




import numpy as np
from numpy.polynomial import hermite 
  
a = np.array([[1,2,3,4,5],[6,7,8,9,10]])
  
# Dimensions of Array
print("\nDimensions of Array:\n",a.ndim)
  
# Shape of the array
print("\nShape of Array:\n",a.shape)
  
# Tuple
x = [6,7,8,9,10]
  
# To evaluate a Hermite series at
# points x broadcast over the columns
hermite.hermval(x,a,tensor=True)


Output:

Dimensions of Array:
 2

Shape of Array:
 (2, 5)

array([[ 73.,  85.,  97., 109., 121.],
       [ 86., 100., 114., 128., 142.],
       [ 99., 115., 131., 147., 163.],
       [112., 130., 148., 166., 184.],
       [125., 145., 165., 185., 205.]])
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32260 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6626 POSTS0 COMMENTS
Nicole Veronica
11795 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11855 POSTS0 COMMENTS
Shaida Kate Naidoo
6747 POSTS0 COMMENTS
Ted Musemwa
7023 POSTS0 COMMENTS
Thapelo Manthata
6695 POSTS0 COMMENTS
Umr Jansen
6714 POSTS0 COMMENTS