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 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 such that it is of 3 Dimensions.
Syntax: laguerre.lagval2d(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 Laguerre Series at points [3,4],[1,2].
Python3
# import numpy moduleimport numpyÂ
# import laguerrefrom numpy.polynomial import laguerreÂ
# Create 1d array of 5 elementscoefficient_array = numpy.array([45, 67, 54, 53, 15])Â
# Displayprint(coefficient_array)Â
# display the Dimensionsprint(coefficient_array.ndim)Â
# display Shapeprint(coefficient_array.shape)Â
# Evaluate a 2D Laguerre series at points# (x,y) - [3,4],[1,2]print(laguerre.lagval2d([3, 4], [1, 2], coefficient_array)) |
Output:
[45 67 54 53 15] 1 (5,) [-42.375 -79.04166667]
Example 2:
In this example, we are creating a NumPy array with 6 coefficients and evaluating Laguerre Series at points [1,4],[1,2].
Python3
# import numpy moduleimport numpy Â
# import laguerrefrom numpy.polynomial import laguerreÂ
# Create 1d array of 6 elementscoefficient_array = numpy.array([45,67,54,53,67, 15])Â
# Display print(coefficient_array)Â
# display the Dimensionsprint(coefficient_array.ndim)Â
# display Shapeprint(coefficient_array.shape)Â
# Evaluate a 2D Laguerre series at points# (x,y) - [1,4],[1,2]print(laguerre.lagval2d([1,4],[1,2],coefficient_array)) |
Output:
[45 67 54 53 67 15] 1 (6,) [ -66.20833333 -141.875]
