它通过使用在对数刻度上均匀分隔的数字来创建数组。
numpy.logspace(start, stop, num, endpoint, base, dtype)
它接受以下参数。
返回指定范围内的数组。
import numpy as np arr = np.logspace(10, 20, num = 5, endpoint = True) print("The array over the given range is ",arr)
输出:
The array over the given range is [1.00000000e+10 3.16227766e+12 1.00000000e+15 3.16227766e+17 1.00000000e+20]
import numpy as np arr = np.logspace(10, 20, num = 5,base = 2, endpoint = True) print("The array over the given range is ",arr)
输出:
The array over the given range is [1.02400000e+03 5.79261875e+03 3.27680000e+04 1.85363800e+05 1.04857600e+06]
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)
Spring Cloud 微服务项目实战 -〔姚秋辰(姚半仙)〕