其他
NumPy教程-numpy.logspace()
语法
numpy.logspace(start, stop, num, endpoint, base, dtype)
参数
start:在基数中表示区间的起始值。 stop:在基数中表示区间的结束值。 num:区间内的值的数量。 endpoint:一个布尔类型的值。它使得 stop 表示区间的最后一个值。 base:表示对数空间的底数。 dtype:表示数组项的数据类型。
返回值
示例 1
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]
示例 2
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]