numpyのlinspace関数


linspace関数は、num個の均一な間隔のサンプルを含む指定された範囲(startからstop)内で1つの配列(ここでの配列はndarray配列を指す)を返すことができます.
np.linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=float, axis=0)
#start:      
#stop:     
#num(  ):       ,   50
#endpoint(  ): endpoint=True      , endpoint=False       
#retstep(  ): retstep=True     , retstep=False      
#dtype(  ):       。     dtype,               
#axis(  ):  axis=0   axis=-1
>>> import numpy as np
>>> np.linspace(0, 49)
array([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9., 10., 11., 12.,
       13., 14., 15., 16., 17., 18., 19., 20., 21., 22., 23., 24., 25.,
       26., 27., 28., 29., 30., 31., 32., 33., 34., 35., 36., 37., 38.,
       39., 40., 41., 42., 43., 44., 45., 46., 47., 48., 49.])
>>> np.linspace(0, 6, 7)
array([0., 1., 2., 3., 4., 5., 6.])
>>> np.linspace(0, 6, 7, endpoint=False)
array([0.        , 0.85714286, 1.71428571, 2.57142857, 3.42857143,
       4.28571429, 5.14285714])