Python | Numpy np.leggrid2d() method (original) (raw)
Last Updated : 31 Dec, 2019
**np.leggrid2d()**
method is used to evaluate a 2-D legendre series on the Cartesian product of x and y.
Syntax :
np.leggrid2d(x, y, c)
Parameters:
**x, y :**[array_like]The two dimensional series is evaluated at the points in the Cartesian product of x and y. If x or y is a list or tuple, it is first converted to an ndarray, otherwise it is left unchanged and, if it isn’t an ndarray, it is treated as a scalar.
**c :**[array_like] 1-D arrays of legendre series coefficients ordered from low to high.Return : [ndarray] The values of the two dimensional legendre series at points in the Cartesian product of x and y.
Code #1 :
import
numpy as np
from
numpy.polynomial.legendre
import
leggrid2d
c
=
np.array([[
1
,
3
,
5
], [
2
,
4
,
6
]])
ans
=
leggrid2d([
7
,
9
], [
8
,
10
], c)
print
(ans)
Output:
[[ 4751.5 7351.5] [ 5965.5 9229.5]]
Code #2 :
import
numpy as np
from
numpy.polynomial.legendre
import
leggrid2d
c
=
np.array([[
1
,
3
,
5
], [
2
,
4
,
6
]])
ans
=
leggrid2d(
7
,
8
, c)
print
(ans)
Similar Reads
- Python | Numpy np.leggrid3d() method np.leggrid3d() method is used to evaluate a 3-D legendre series on the Cartesian product of x, y and z. Syntax : np.leggrid3d(x, y, z, c) Parameters: x, y, z :[array_like]The three dimensional series is evaluated at the points in the Cartesian product of x, y and z. If x or y or z is a list or tuple 2 min read
- Python | Numpy np.legadd() method np.legadd() method is used to add one Legendre series to another.It returns the sum of two Legendre series c1 + c2. Syntax : np.legadd(c1, c2) Parameters: c1, c2 :[ array_like ] 1-D arrays of Legendre series coefficients ordered from low to high. Return : [ndarray] Array representing the Legendre se 1 min read
- Python | Numpy np.hermegrid2d() method With the help of np.hermegrid2d() method, we can evaluate a 2-D hermite series on cartesian product of (x, y), where (x, y) is defined in the np.hermegrid2d() method. Syntax : np.hermegrid2d(x, y, series) Return : Return the evaluated 2-D hermite series. Example #1 : In this example we can see that 1 min read
- Python | Numpy np.legdiv() method np.legdiv() method is used to divide one Legendre series to another.It returns the quotient-with-remainder of two Legendre series c1 / c2. Syntax : np.legdiv(c1, c2) Parameters: c1, c2 :[ array_like ] 1-D arrays of Legendre series coefficients ordered from low to high. Return : [ndarray] Legendre se 1 min read
- Python | Numpy np.legvander2d() method With the help of np.legvander2d() method, we can get the Pseudo-Vandermonde matrix from given array having degree which is passed as parameter by using np.legvander2d() method. Syntax : np.legvander2d(x, y, deg) Parameters: x, y :[ array_like ] Array of points. The dtype is converted to float64 or c 2 min read
- Python | Numpy np.legzero() method np.legzero() method can be used instead of np.zeros for creating a array whose elements are 0. Syntax : np.legzero() Return : Return array([0]) Example #1 : # Python program explaining # numpy.legzero() method # import numpy and legzero import numpy as np from numpy.polynomial.legendre import legzer 1 min read
- Python | Numpy np.leg2poly() method np.leg2poly() method is used to convert a legendre series to a polynomial. Syntax : np.leg2poly(c) Parameters: c :[array_like] 1-D arrays of legendre series coefficients ordered from low to high. Return : [ndarray] 1-D array containing the coefficients of the equivalent polynomial. Code #1 : # Pytho 1 min read
- Python | Numpy np.legroots() method np.legroots() method is used to compute the roots of a legendre series.Return the roots of the polynomial. Syntax : np.legroots(c) Parameters: c :[array_like] 1-D arrays of legendre series coefficients. Return : [ndarray] Array of the roots of the series. If all the roots are real, then out is also 1 min read
- Python | Numpy np.leggauss() method np.leggauss() Computes the sample points and weights for Gauss-legendre quadrature. These sample points and weights will correctly integrate polynomials of degree 2*deg - 1 or less over the interval [-1, 1] with the weight function f(x) = 1 Syntax : np.leggauss(deg) Parameters: deg :[int] Number of 1 min read
- Python | Numpy np.legvander3d() method np.legvander3d() method is used to returns the Vandermonde matrix of degree deg and sample points x, y and z. Syntax : np.legvander3d(x, y, z, deg) Parameters: x, y, z :[ array_like ] Array of points. The dtype is converted to float64 or complex128 depending on whether any of the elements are comple 2 min read