在python库numpy 中提供了函数linspace和logspace函数用于生产等差数列和等比数列。

    1.linspace函数生成等差数列

def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None):

指定初始值、终止值、数量、是否包含终止值,默认为包含。

 



2.logspace函数生成等比数列
def logspace(start, stop, num=50, endpoint=True, base=10.0, dtype=None):
指定初始值、终止值、数量、是否包含终止值,默认为包含。

 
posted on 2017-12-16 11:27  未完代码  阅读(43609)  评论(0编辑  收藏  举报