Python | Numpy np.leg2poly() method (original) (raw)
Last Updated : 29 Dec, 2019
**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 :
import
numpy as np
import
numpy.polynomial.legendre as geek
c
=
np.array([
0.1
,
0.2
,
0.3
,
0.4
,
0.5
])
res
=
geek.leg2poly(c)
print
(res)
Output:
[ 0.1375 -0.4 -1.425 1. 2.1875]
Code #2 :
import
numpy as np
import
numpy.polynomial.legendre as geek
c
=
(
1
,
2
,
3
,
4
,
5
)
res
=
geek.leg2poly(c)
print
(res)
Output:
[ 1.375 -4. -14.25 10. 21.875]
Similar Reads
- Python | Numpy np.lag2poly() method np.lag2poly() method is used to convert a Laguerre series to a polynomial. Syntax : np.lag2poly(c) Parameters: c :[array_like] 1-D arrays of Laguerre 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.legmul() method np.legmul() method is used to multiply one Legendre series to another.It returns the product of two Legendre series c1 * c2. Syntax : np.legmul(c1, c2) Parameters: c1, c2 :[ array_like ] 1-D arrays of Legendre series coefficients ordered from low to high. Return : [ndarray] Legendre series coefficie 1 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.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.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.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.legsub() method np.legub() method is used to subtract one Legendre series to another.It returns the difference of two Legendre series c1 - c2. Syntax : np.legub(c1, c2) Parameters: c1, c2 :[ array_like ] 1-D arrays of Legendre series coefficients ordered from low to high. Return : [ndarray] Legendre series coeffici 1 min read
- Python | Numpy np.leggrid2d() method 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 conve 2 min read
- Python | Numpy np.legdomain() method With the help of np.legdomain() method, we can get the filter having value array([-1, 1]) in legendre series. Syntax : np.legdomain Return : Return filter of array([-1, 1]) Example #1 : # Python program explaining # numpy.legdomain() method # import numpy and legdomain import numpy as np from numpy. 1 min read
- Python | Numpy np.legcompanion() method np.legcompanion() method is used to return the companion matrix of legendre series. Syntax : np.legcompanion(c) Parameters: c :[array_like] 1-D arrays of legendre series coefficients ordered from low to high. Return : [ndarray] Companion matrix of dimensions (deg, deg). Code #1 : # Python program ex 1 min read