Python Numpy np.legzero()方法
可以用 np.legzero() 方法代替np.zeros来创建一个元素为0的数组。
语法: np.legzero()
返回 : 返回数组([0])
例子#1 :
# Python program explaining
# numpy.legzero() method
# import numpy and legzero
import numpy as np
from numpy.polynomial.legendre import legzero
# using np.legzero() method
ans = legzero
print(ans)
输出 :
[0]
例子#2 :
# Python program explaining
# numpy.legzero() method
# import numpy and legzero
import numpy as np
from numpy.polynomial.legendre import legzero
# using np.legzero() method
ans = legzero + [[1, 3, 5], [2, 4, 6]]
print(ans)
输出 :
[[1 3 5]
[2 4 6]]