Monday, August 15, 2022
HomeSoftware DevelopmentConsider a 2D Laguerre collection at factors (x,y) with 1D array of...

Consider a 2D Laguerre collection at factors (x,y) with 1D array of coefficient utilizing NumPy in Python

On this article, we are going to Consider a 2D Laguerre collection at factors (x,y) with a 1D array of coefficient

Laguerre.lagval2d technique

In Python, laguerre.lagval2d() is used to judge a 2D Laguerre collection at factors (x,y). the place coefficient_array is the enter NumPy 1D array with coefficients and factors known as x and y. The primary parameter generally is a listing of pointsSo now we have to offer two listing such that every listing has an x-point and y-point.The second parameter is an numpy array of coefficients ordered such that it’s of three Dimensions.

Syntax: laguerre.lagval2d(x,y,c)

Parameters:

• x,y: array_like, appropriate objects
• c: Array of coefficients.

Return: The values of the 2 dimensional polynomial at factors

Instance 1:

On this instance, we’re making a NumPy array with 5 coefficients to judge Laguerre Collection at factors [3,4],[1,2].

Python3

 `import` `numpy` ` `  `from` `numpy.polynomial ``import` `laguerre` ` `  `coefficient_array ``=` `numpy.array([``45``, ``67``, ``54``, ``53``, ``15``])` ` `  `print``(coefficient_array)` ` `  `print``(coefficient_array.ndim)` ` `  `print``(coefficient_array.form)` ` `  `print``(laguerre.lagval2d([``3``, ``4``], [``1``, ``2``], coefficient_array))`

Output:

```[45 67 54 53 15]
1
(5,)
[-42.375      -79.04166667]```

Instance 2:

On this instance, we’re making a NumPy array with 6 coefficients and evaluating Laguerre Collection at factors [1,4],[1,2].

Python3

 `import` `numpy ` ` `  `from` `numpy.polynomial ``import` `laguerre` ` `  `coefficient_array ``=` `numpy.array([``45``,``67``,``54``,``53``,``67``, ``15``])` ` `  `print``(coefficient_array)` ` `  `print``(coefficient_array.ndim)` ` `  `print``(coefficient_array.form)` ` `  `print``(laguerre.lagval2d([``1``,``4``],[``1``,``2``],coefficient_array))`

Output:

```[45 67 54 53 67 15]
1
(6,)
[ -66.20833333 -141.875]```

RELATED ARTICLES