numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None, axis=0)

Returns :None:None:`num` evenly spaced samples, calculated over the interval [`start`, :None:None:`stop`].

The endpoint of the interval can optionally be excluded.

versionchanged

Non-scalar :None:None:`start` and :None:None:`stop` are now supported.

versionchanged

Values are rounded towards -inf instead of 0 when an integer dtype is specified. The old behavior can still be obtained with np.linspace(start, stop, num).astype(int)

Parameters

start : array_like

The starting value of the sequence.

stop : array_like

The end value of the sequence, unless :None:None:`endpoint` is set to False. In that case, the sequence consists of all but the last of num + 1 evenly spaced samples, so that :None:None:`stop` is excluded. Note that the step size changes when :None:None:`endpoint` is False.

num : int, optional

Number of samples to generate. Default is 50. Must be non-negative.

endpoint : bool, optional

If True, :None:None:`stop` is the last sample. Otherwise, it is not included. Default is True.

retstep : bool, optional

If True, return (:None:None:`samples`, :None:None:`step`), where :None:None:`step` is the spacing between samples.

dtype : dtype, optional

The type of the output array. If dtype is not given, the data type is inferred from :None:None:`start` and :None:None:`stop`. The inferred dtype will never be an integer; :None:None:`float` is chosen even if the arguments would produce an array of integers.

versionadded
axis : int, optional

The axis in the result to store the samples. Relevant only if start or stop are array-like. By default (0), the samples will be along a new axis inserted at the beginning. Use -1 to get an axis at the end.

versionadded

Returns

samples : ndarray

There are :None:None:`num` equally spaced samples in the closed interval [start, stop] or the half-open interval [start, stop) (depending on whether :None:None:`endpoint` is True or False).

step : float, optional

Only returned if :None:None:`retstep` is True

Size of spacing between samples.

Return evenly spaced numbers over a specified interval.

See Also

arange

Similar to :None:None:`linspace`, but uses a step size (instead of the number of samples).

geomspace

Similar to :None:None:`linspace`, but with numbers spaced evenly on a log scale (a geometric progression).

logspace

Similar to :None:None:`geomspace`, but with the end points specified as logarithms.

Examples

>>> np.linspace(2.0, 3.0, num=5)
array([2.  , 2.25, 2.5 , 2.75, 3.  ])
>>> np.linspace(2.0, 3.0, num=5, endpoint=False)
array([2. ,  2.2,  2.4,  2.6,  2.8])
>>> np.linspace(2.0, 3.0, num=5, retstep=True)
(array([2.  ,  2.25,  2.5 ,  2.75,  3.  ]), 0.25)

Graphical illustration:

>>> import matplotlib.pyplot as plt
... N = 8
... y = np.zeros(N)
... x1 = np.linspace(0, 10, N, endpoint=True)
... x2 = np.linspace(0, 10, N, endpoint=False)
... plt.plot(x1, y, 'o') [<matplotlib.lines.Line2D object at 0x...>]
>>> plt.plot(x2, y + 0.5, 'o')
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.ylim([-0.5, 1])
(-0.5, 1)
>>> plt.show()
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy

127 Elements
scipy.signal.exponential
scipy.signal.windows._windows.boxcar
scipy.signal._wavelets.morlet2
scipy.interpolate._polyint.krogh_interpolate
scipy.linalg._decomp_svd.svdvals
scipy.signal.bartlett
scipy.signal._bsplines.cspline1d_eval
scipy.interpolate._bsplines.make_lsq_spline
scipy.interpolate._bspl.evaluate_all_bspl
scipy.integrate._quadrature.newton_cotes
scipy.signal.windows._windows.barthann
scipy.signal.chebwin
scipy.signal._czt.CZT
scipy.spatial.transform._rotation_spline.RotationSpline
scipy.signal.boxcar
scipy.interpolate._polyint.barycentric_interpolate
scipy.signal._arraytools.even_ext
scipy.signal._signaltools.lfilter
scipy.signal.windows._windows.hann
scipy.signal._waveforms.square
scipy.signal._bsplines.cspline1d
scipy.signal._signaltools.detrend
scipy.interpolate._fitpack2.SmoothSphereBivariateSpline
scipy.signal._peak_finding.peak_widths
scipy.signal._ltisys.lsim2
scipy.optimize._optimize.rosen
scipy.signal.blackmanharris
scipy.interpolate._polyint.approximate_taylor_polynomial
scipy.signal._signaltools.resample_poly
scipy.integrate._quadrature.cumulative_trapezoid
scipy.integrate._quad_vec.quad_vec
scipy.signal.windows._windows.chebwin
scipy.signal.parzen
scipy.signal._waveforms.sweep_poly
scipy.signal.barthann
scipy.interpolate._bsplines.make_interp_spline
scipy.signal.windows._windows.general_cosine
scipy.signal._czt.zoom_fft
scipy.signal.flattop
scipy.signal.windows._windows.triang
scipy.signal._filter_design.ellip
scipy.interpolate._fitpack2.UnivariateSpline.derivative
scipy.signal.windows._windows.exponential
scipy.signal._signaltools.filtfilt
scipy.signal.windows._windows.blackman
scipy.signal.windows._windows.cosine
scipy.signal.gaussian
scipy.signal._waveforms.sawtooth
scipy.interpolate._fitpack2.UnivariateSpline
scipy.signal._filter_design.butter
scipy.sparse.linalg._expm_multiply.expm_multiply
scipy.signal.windows._windows.tukey
scipy.interpolate._fitpack_impl.splrep
scipy.signal._lti_conversion.cont2discrete
scipy.signal.hann
scipy.signal.tukey
scipy.signal.bohman
scipy.signal._wavelets.cwt
scipy.signal.hamming
scipy.interpolate._ndgriddata.NearestNDInterpolator
scipy.interpolate._fitpack2.UnivariateSpline.integral
scipy.signal.windows._windows.kaiser
scipy.signal.cosine
scipy.signal._waveforms.chirp
scipy.interpolate._fitpack2.UnivariateSpline.derivatives
scipy.signal._bsplines.qspline1d
scipy.signal._ltisys.lsim
scipy.signal._signaltools.resample
scipy.interpolate._bsplines.BSpline
scipy.linalg._basic.lstsq
scipy.interpolate._polyint.KroghInterpolator
scipy.interpolate._fitpack_py.insert
scipy.interpolate._interpolate.RegularGridInterpolator
scipy.spatial._geometric_slerp.geometric_slerp
scipy.signal._spectral_py.lombscargle
scipy.interpolate._fitpack2.LSQUnivariateSpline
scipy.signal._signaltools.sosfiltfilt
scipy.interpolate._fitpack2.RectSphereBivariateSpline
scipy.signal._bsplines.qspline1d_eval
scipy.signal._signaltools.decimate
scipy.signal.windows._windows.taylor
scipy.signal.windows._windows.bartlett
scipy.interpolate._interpolate.interpn
scipy.signal.triang
scipy.interpolate._fitpack_impl.splantider
scipy.interpolate._fitpack2.InterpolatedUnivariateSpline
scipy.optimize._optimize.bracket
scipy.signal.windows._windows.bohman
scipy.signal._arraytools.odd_ext
scipy.signal._czt.ZoomFFT
scipy.signal._ltisys.place_poles
scipy.optimize._minpack_py.curve_fit
scipy.interpolate._fitpack_impl.splder
scipy.spatial._qhull.HalfspaceIntersection
scipy.interpolate._fitpack_py.splantider
scipy.interpolate._cubic.pchip_interpolate
scipy.signal.blackman
scipy.signal.windows._windows.nuttall
scipy.signal.windows._windows.general_gaussian
scipy.signal.windows._windows.gaussian
scipy.signal.windows._windows.flattop
scipy.special._orthogonal.gegenbauer
scipy.interpolate._rbf.Rbf
scipy.signal._waveforms.gausspulse
scipy.interpolate._fitpack2.UnivariateSpline.antiderivative
scipy.interpolate._fitpack_py.splder
scipy.signal._peak_finding.find_peaks
scipy.signal.windows._windows.general_hamming
scipy.special._basic.diric
scipy.signal.kaiser
scipy.signal.general_gaussian
scipy.signal.windows._windows.parzen
scipy.special._ellip_harm.ellip_harm
scipy.signal._peak_finding.peak_prominences
scipy.interpolate._fitpack2.LSQSphereBivariateSpline
scipy.signal.nuttall
scipy.signal._filter_design.cheby1
scipy.signal.windows._windows.blackmanharris
scipy.integrate._bvp.solve_bvp
scipy.integrate._odepack_py.odeint
scipy.signal._arraytools.const_ext
scipy.integrate._ivp.ivp.solve_ivp
scipy.signal._filter_design.cheby2
scipy.interpolate._fitpack_py.splrep
scipy.interpolate._cubic.CubicSpline
scipy.interpolate.interpnd.LinearNDInterpolator
scipy.signal.windows._windows.hamming

dask

14 Elements
dask.array.ufunc.wrap_elemwise.<locals>.wrapped
dask.array.routines.outer
dask.array.routines.piecewise
dask.array.ufunc.cosh
dask.array.ufunc.arccos
dask.array.random.RandomState.power
dask.array.random.RandomState.lognormal
dask.array.ufunc.sin
dask.array.routines.histogramdd
dask.array.creation.meshgrid
dask.array.ufunc.absolute
dask.array.random.RandomState.vonmises
dask.array.ufunc.exp
dask.array.ufunc.arctan

numpy

numpy.geomspace
numpy.logspace
numpy.arange

skimage

skimage.measure.fit.ransac
skimage.exposure.exposure.is_low_contrast
skimage.restoration.inpaint.inpaint_biharmonic
skimage.measure.fit.CircleModel
skimage.measure.fit.EllipseModel
skimage.measure.fit.LineModelND
skimage.segmentation.active_contour_model.active_contour

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/core/function_base.py#23
type: <class 'function'>
Commit: