Evaluate a 2-D Hermite series at points (x,y) in using NumPy Python
Last Updated :
03 Jun, 2022
In this article, we will Evaluate a 2D Hermite series at points (x,y) in Numpy using python.
hermite.hermval2d method
In Python, To evaluate a Hermite series at points x with a multidimensional coefficient array, NumPy provides a function called hermite.hermval(), But to evaluate 2D Hermite series, hermite.hermval2d() is used to evaluate a 2D Hermite series at points (x,y). where coefficient_array is the input NumPy array with coefficients and points referred to as x and y. The first parameter can be a list of points. So we have to provide two lists such that each list has an x-point and y-point. The second parameter is a NumPy array of coefficients ordered.
Syntax: hermite.hermval2d(x,y,c)
Parameters:
- x,y: array_like, compatible objects
- c: Array of coefficients.
Return: The values of the two dimensional polynomial at points.
Example 1:
In this example, we are creating a NumPy array with 5 coefficients to evaluate Hermite Series at points [3,4],[1,2]. By using ndim, we are getting a total number of dimensions, and using shape, we are returning the shape of an array.
Python3
# import numpy module
import numpy
# import hermite
from numpy.polynomial import hermite
# Create 1d array of 5 elements
coefficient_array = numpy.array([45, 67, 54, 53, 15])
# Display
print(coefficient_array)
# display the Dimensions
print(coefficient_array.ndim)
# display Shape
print(coefficient_array.shape)
# Evaluate a 2D hermite series at points
# (x,y) - [3,4],[1,2]
print(hermite.hermval2d([3, 4], [1, 2], coefficient_array))
Output:
[45 67 54 53 15]
1
(5,)
[182205. 339447.]
Example 2:
In this example, we are creating a NumPy array with 6 coefficients and evaluating Hermite Series at points [1,4],[1,2]. By using ndim, we are getting a total number of dimensions, and using shape, we are returning the shape of an array.
Python3
# import numpy module
import numpy
# import hermite
from numpy.polynomial import hermite
# Create 1d array of 6 elements
coefficient_array = numpy.array([45, 67, 54, 53, 67, 15])
# Display
print(coefficient_array)
# display the Dimensions
print(coefficient_array.ndim)
# display Shape
print(coefficient_array.shape)
# Evaluate a 2D hermite series at points
# (x,y) - [1,4],[1,2]
print(hermite.hermval2d([1, 4], [1, 2], coefficient_array))
Output:
[45 67 54 53 67 15]
1
(6,)
[1193457. 2388299.]
Example 3:
In this example, we are creating a 2 D NumPy array with 3 coefficients each and evaluating Hermite Series at points [1,4],[1,2]. By using ndim, we are getting a total number of dimensions, and using shape, we are returning the shape of an array.
Python3
# import numpy module
import numpy
# import hermite
from numpy.polynomial import hermite
# Create 2d array of 3 elements each
coefficient_array = numpy.array([[45, 67, 54],
[53, 67, 15]])
# Display
print(coefficient_array)
# display the Dimensions
print(coefficient_array.ndim)
# display Shape
print(coefficient_array.shape)
# Evaluate a 2D hermite series at points
# (x,y) - [1,4],[1,2]
print(hermite.hermval2d([1, 4], [1, 2], coefficient_array))
Output:
[[45 67 54]
[53 67 15]]
2
(2, 3)
[ 721. 5317.]
Similar Reads
Evaluate a 2-D Hermite_e series at points (x,y) using NumPy in Python In this article, we will cover how to evaluate a 2-D Hermite_e series at points (x,y) in Python. polynomial.hermite.hermval2d The numpy.polynomial.hermite.hermval2d() from the NumPy library is used to Evaluate a 2-D Hermite_e series at points(x,y) in Python. If the parameters x and y are tuples or l
3 min read
Evaluate a Hermite_e series at points x in using NumPy Python In this article, we will cover how to evaluate a Hermite_e series at points x using NumPy in Python. numpy.polynomial.hermite.hermval The numpy.polynomial.hermite.hermval() method from the NumPy library is used to evaluate a Hermite series at points x. If the parameter x is a tuple or a list, it is
2 min read
Evaluate a Hermite_e series at list of points x using NumPy in Python In this article, we will cover how to evaluate a Hermite_e series at the list of points x using NumPy in Python. numpy.polynomial.hermite.hermval To evaluate a Hermite series at points x with a multidimensional coefficient array, NumPy provides a function called hermite.hermval(). It takes two param
3 min read
Evaluate a Hermite_e series at list of points x using NumPy in Python 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
3 min read
Evaluate a Hermite series at list of points x using NumPy in Python In this article, we will be looking toward the approach to evaluating a Hermite series at a list of points x in Python and NumPy. Example: List: [6,7,8,9,10] Result: [102175. 191631. 329175. 529399. 808815.] Explanation: Hermite series at points x.NumPy.polynomial.hermite.hermval() method To evaluat
2 min read