In this article, we will evaluate a 3D Laguerre Series at points (x,y) with 4 dimensional array of coefficient in Python.
laguerre.lagval3d()
The laguerre.lagval3d() is used to evaluate a 3D Laguerre series at points (x,y) which returns the values of the multidimensional polynomial on points formed with triples of corresponding values from x, y, and z values, So we have to provide three lists such that each list has an x-point and y-point.
Syntax: laguerre.lagval3d(points,coefficient_array)
Parameters:
- Points(x,y): The first parameter can be a list of points – x and y.
- c: It is an numpy array of coefficients ordered such that it is of 3 Dimensions.
Return: multidimensional polynomial on points
Example 1:
In this example, we are creating numpy array with coefficients from 0 to 47 with (2*6) each and evaluate Laguerre Series at points [3,4],[1,2],[6,7].
Python3
# import numpy module import numpy # import laguerre from numpy.polynomial import laguerre # Create 1d array of 6 elements coefficient_array = numpy.arange( 48 ).reshape( 2 , 2 , 6 , 2 ) # Display print (coefficient_array) # display the Dimensions print (coefficient_array.ndim) # display Shape print (coefficient_array.shape) # Evaluate a 3D Laguerre series at # points (x,y) - [3,4],[1,2],[6,7] print (laguerre.lagval3d([ 3 , 4 ],[ 1 , 2 ],[ 6 , 7 ],coefficient_array)) |
Output:
Example 2:
In this example we are creating NumPy array with coefficients from 0 to 47 with (2*6) each and evaluate Laguerre Series at points [0,0],[0,0] and [0,0].
Python3
# import numpy module import numpy # import laguerre from numpy.polynomial import laguerre # Create 1d array of 6 elements coefficient_array = numpy.arange( 48 ).reshape( 2 , 2 , 6 , 2 ) # Display print (coefficient_array) # display the Dimensions print (coefficient_array.ndim) # display Shape print (coefficient_array.shape) # Evaluate a 3D Laguerre series at points # (x,y) - [0,0],[0,0],[0,0] print (laguerre.lagval3d([ 0 , 0 ],[ 0 , 0 ],[ 0 , 0 ],coefficient_array)) |
Output: