Python | Numpy np.legmul() method (original) (raw)
Last Updated : 31 Dec, 2019
**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 coefficients representing their product.
Code #1 :
import
numpy as np
import
numpy.polynomial.legendre as geek
s1
=
(
2
,
4
,
8
)
s2
=
(
1
,
3
,
5
)
res
=
geek.legmul(s1, s2)
print
(res)
Output:
[ 14. 27.6 37.42857143 26.4 20.57142857]
Code #2 :
import
numpy as np
import
numpy.polynomial.legendre as geek
s1
=
(
10
,
20
,
30
,
40
,
50
)
s2
=
(
2
,
4
,
6
,
8
,
10
)
res
=
geek.legmul(s1, s2)
print
(res)
Output:
[ 183.93650794 451.80952381 666.43578644 755.23232323 786.997003 626.61782662 512.26551227 326.34032634 190.36519037]
Similar Reads
- 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.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.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.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.legone() method np.legone() method can be used instead of np.ones for creating a array whose elements are 1. Syntax : np.legone() Return : Return array([1]) Example #1 : # Python program explaining # numpy.legone() method # import numpy and legone import numpy as np from numpy.polynomial.legendre import legone # us 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.legvander() method np.legvander() method is used to returns the Vandermonde matrix of degree deg and sample points x. Syntax : np.legvander(x, deg) Parameters: x :[ array_like ] Array of points. The dtype is converted to float64 or complex128 depending on whether any of the elements are complex. If x is scalar it is c 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