Saturday, December 28, 2024
Google search engine
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 Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments

ź°•ģ„œźµ¬ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
źøˆģ²œźµ¬ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ź“‘ėŖ…ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ź“‘ėŖ…ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ė¶€ģ²œģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
źµ¬ģ›”ė™ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ź°•ģ„œźµ¬ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ģ˜¤ģ‚°ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ź“‘ėŖ…ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ģ•ˆģ–‘ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ė¶€ģ²œģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ė™ķƒ„ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ģ„œģšøģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ė¶„ė‹¹ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ė¶€ģ²œģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ķ™”ź³”ė™ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ź°•ģ„œźµ¬ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ź³ ģ–‘ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ķ™”ģ„±ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ģ²œķ˜øė™ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?