Evaluate 2-D Hermite series on the Cartesian product of x and y with 1d array of coefficient using NumPy in Python
Last Updated :
03 Jun, 2022
In this article, we will discuss how to Evaluate a 2-D Hermite series on the Cartesian product of x and y with a 1d array of coefficients in Python using NumPy.
NumPy.polynomial.hermite.hermgrid2d method
Hermite polynomials are significant in approximation theory because the Hermite nodes are used as matching points for optimizing polynomial interpolation. To perform the Hermite cartesian product, NumPy provides a function called Hermite.hermgrid2d which can be used to evaluate the cartesian product of the 1D Hermite series. This function converts the parameters x and y to array only if they are tuples or a list, otherwise, it is left unchanged and, if it is not an array, it is treated as a scalar.
Syntax: polynomial.hermite.hermgrid2d(x, y, c)
Parameters:
- x,y: array_like
- c: array of coefficients
Returns: Two dimensional polynomials at points as cartesian products of x and y.
Example 1:
In the first example. let us consider a 1D array c that has 5 elements. Let us consider a 2D series [1,2],[1,2] to evaluate against the 1D array. Import the necessary packages as shown and pass the appropriate parameters as shown below.
Python3
import numpy as np
from numpy.polynomial import hermite
# coefficient array
c = np.array([1, 2, 3, 4, 5])
print(f'The co.efficient array is {c}')
print(f'The shape of the array is {c.shape}')
print(f'The dimension of the array is {c.ndim}D')
print(f'The datatype of the array is {c.dtype}')
# evaluating 1d co.eff array with a 2d
# hermite series
res = hermite.hermgrid2d([1, 2], [1, 2], c)
# resultant array
print(f'Resultant series ---> {res}')
Output:
The co.efficient array is [1 2 3 4 5]
The shape of the array is (5,)
The dimension of the array is 1D
The datatype of the array is int64
Resultant series ---> [1077. 2259.]
Example 2:
In the first example. let us consider a 1D array c that has 10 elements. Let us consider a 2D series [2,1],[2,1] to evaluate against the 1D array. Import the necessary packages as shown and pass the appropriate parameters as shown below.
Python3
import numpy as np
from numpy.polynomial import hermite
# coefficient array
c = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
print(f'The co.efficient array is {c}')
print(f'The shape of the array is {c.shape}')
print(f'The dimension of the array is {c.ndim}D')
print(f'The datatype of the array is {c.dtype}')
# evaluating 1d coeff array with a 2d
# hermite series
res = hermite.hermgrid2d([2, 1], [2, 1], c)
# resultant array
print(f'Resultant series ---> {res}')
Output:
The co.efficient array is [ 1 2 3 4 5 6 7 8 9 10]
The shape of the array is (10,)
The dimension of the array is 1D
The datatype of the array is int64
Resultant series ---> [-45325. 189045.]
Similar Reads
Evaluate 2-D Hermite series on the Cartesian product of x and y with 3d array of coefficient using NumPy in Python In this article, we will discuss how to Evaluate a 2-D Hermite series on the Cartesian product of x and y with a 3d array of coefficients in Python and NumPy. NumPy.polynomial.hermite.hermgrid2d method Hermite polynomials are significant in approximation theory because the Hermite nodes are used as
3 min read
Evaluate a 2-D Hermite series at points (x,y) with 3D array of coefficient using NumPy in Python In this article, we'll look at how to evaluate a 2-dimensional Hermite series using NumPy in Python at an array of points x, and y with the 3-dimensional array. np.hermval2d method We are using the hermite.hermval2d() function from the Numpy module to evaluate a 2D Hermite series at locations (x, y)
2 min read
Evaluate 3-D Hermite series on the Cartesian product of x, y and z using NumPy in Python In this article, we will discuss how to Evaluate a 3-D Hermite series on the Cartesian product of x, y, and z  in Python and NumPy. NumPy.polynomial.hermite.hermgrid3d method Hermite polynomials are significant in approximation theory because the Hermite nodes are used as matching points for optimiz
3 min read
Evaluate a 2-D Hermite_e series at points (x,y) with 3D array of coefficient using NumPy in Python In this article, we will cover how to evaluate a 2-D Hermite_e series at points (x,y) with a 3D array of coefficients using NumPy in Python. np.polynomial.hermite_e.hermeval2d method The np.polynomial.hermite_e.hermeval2d from the NumPy library is used to Evaluate a 2-D Hermite_e series at points(x,
3 min read
Evaluate a 3-D Chebyshev series on the Cartesian product of x, y and z with 4d array of coefficient in Python In this article, we will discuss how to Evaluate a 3-D Chebyshev series on the Cartesian product of x, y, and z with a 4d array of coefficients in Python and NumPy. NumPy.polynomial.chebyshev.chebgrid3d method Chebyshev polynomials are significant in approximation theory because the Chebyshev nodes
3 min read
Evaluate a 2D Laguerre series at points (x,y) with 1D array of coefficient using NumPy in Python In this article, we will Evaluate a 2D Laguerre series at points (x,y) with a 1D array of coefficient Laguerre.lagval2d method In Python, laguerre.lagval2d() is used to evaluate a 2D Laguerre series at points (x,y). where coefficient_array is the input NumPy 1D array with coefficients and points re
2 min read