2019-06-17
阅读量:
638
python的linspace函数
numpy.linspace(start,stop,num = 50,endpoint = True,retstep = False,dtype = None):均匀地返回数字空格。与范围类似但不是步骤而是使用样本编号。
# Python Programming illustrating
# numpy.linspace method
import
numpy as geek
# restep set to True
print("B\n", geek.linspace(2.0, 3.0, num=5, retstep=True), "\n")
# To evaluate sin() in long range
x =
geek.linspace(0, 2, 10)
print("A\n", geek.sin(x))
在IDE上运行
输出:
乙
(array([2.,2.25,2.5,2.75,3。]),0.25)
一个
[0. 0.22039774 0.42995636 0.6183698 0.77637192 0.8961922
0.9719379 0.99988386 0.9786557 0.90929743]






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论