Python | Numpy np.legone() method (original) (raw)
Last Updated : 31 Dec, 2019
**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 :
import
numpy as np
from
numpy.polynomial.legendre
import
legone
ans
=
legone
print
(ans)
Output :
[1]
Example #2 :
import
numpy as np
from
numpy.polynomial.legendre
import
legone
ans
=
legone
+
[[
1
,
3
,
5
], [
2
,
4
,
6
]]
print
(ans)
Output :
[[2 4 6]
[3 5 7]]
Similar Reads
- Python | Numpy np.hermone() method With the help of np.hermone() method, we can use hermone instead of np.ones by using np.hermone() method. Syntax : np.hermone() Return : Return array([1]) Example #1 : In this example we can see that by using np.hermone() method, we are able to get the functionality of np.ones as same as this method 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.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.hermeone() method With the help of np.hermeone() method, we can use hermeone instead of np.ones() by using np.hermeone() method. Syntax : np.hermeone Return : Return the array of ones. Example #1 : In this example we can see that by using np.hermeone() method, we are able to get the functionality of np.ones as same a 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.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.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
- Python | Numpy np.legfromroots() method np.legfromroots() method is used to generate a legendre series with given roots. Syntax : np.legfromroots(roots) Parameters: roots :[array_like] Input sequence containing the roots. Return : [ndarray] 1-D array of coefficients of legendre series. Code #1 : # Python program explaining # numpy.legfrom 1 min read
- Python | Numpy np.hermzero() method With the help of np.hermzero() method, we can use hermzero instead of np.zeros by using np.hermzero() method. Syntax : np.hermzero() Return : Return array([0]) Example #1 : In this example we can see that by using np.hermzero() method, we are able to get the functionality of np.zeros as same as this 1 min read
- Python | Numpy np.digitize() method With the help of np.digitize() method, we can get the indices of the bins to which each value belongs in an array. Syntax : np.digitize(Array, Bin, Right)Return : Return an array of indices of the bins. Example #1 : In this example we can see that by using np.digitize() method, we are able to get th 1 min read