我试图使用numpy.logspace()从1e-10到1e-14生成50个值.
http://docs.scipy.org/doc/numpy/reference/generated/numpy.logspace.html
import numpy as np x = np.logspace(1e-10,1e-14,num=50) print x
我得到的输出不正确:
[ 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]
我还有什么其他选择?
解决方法
>>> import numpy as np >>> np.logspace(-10,-14,50) array([ 1.00000000e-10,8.28642773e-11,6.86648845e-11,5.68986603e-11,4.71486636e-11,3.90693994e-11,3.23745754e-11,2.68269580e-11,2.22299648e-11,1.84206997e-11,1.52641797e-11,1.26485522e-11,1.04811313e-11,8.68511374e-12,7.19685673e-12,5.96362332e-12,4.94171336e-12,4.09491506e-12,3.39322177e-12,2.81176870e-12,2.32995181e-12,1.93069773e-12,1.59985872e-12,1.32571137e-12,1.09854114e-12,9.10298178e-13,7.54312006e-13,6.25055193e-13,5.17947468e-13,4.29193426e-13,3.55648031e-13,2.94705170e-13,2.44205309e-13,2.02358965e-13,1.67683294e-13,1.38949549e-13,1.15139540e-13,9.54095476e-14,7.90604321e-14,6.55128557e-14,5.42867544e-14,4.49843267e-14,3.72759372e-14,3.08884360e-14,2.55954792e-14,2.12095089e-14,1.75751062e-14,1.45634848e-14,1.20679264e-14,1.00000000e-14])