MCPcopy Create free account
hub / github.com/numpy/numpy / logspace

Function logspace

numpy/core/function_base.py:191–299  ·  view source on GitHub ↗

Return numbers spaced evenly on a log scale. In linear space, the sequence starts at ``base ** start`` (`base` to the power of `start`) and ends with ``base ** stop`` (see `endpoint` below). .. versionchanged:: 1.16.0 Non-scalar `start` and `stop` are now supported.

(start, stop, num=50, endpoint=True, base=10.0, dtype=None,
             axis=0)

Source from the content-addressed store, hash-verified

189
190@array_function_dispatch(_logspace_dispatcher)
191def logspace(start, stop, num=50, endpoint=True, base=10.0, dtype=None,
192 axis=0):
193 """
194 Return numbers spaced evenly on a log scale.
195
196 In linear space, the sequence starts at ``base ** start``
197 (`base` to the power of `start`) and ends with ``base ** stop``
198 (see `endpoint` below).
199
200 .. versionchanged:: 1.16.0
201 Non-scalar `start` and `stop` are now supported.
202
203 .. versionchanged:: 1.25.0
204 Non-scalar 'base` is now supported
205
206 Parameters
207 ----------
208 start : array_like
209 ``base ** start`` is the starting value of the sequence.
210 stop : array_like
211 ``base ** stop`` is the final value of the sequence, unless `endpoint`
212 is False. In that case, ``num + 1`` values are spaced over the
213 interval in log-space, of which all but the last (a sequence of
214 length `num`) are returned.
215 num : integer, optional
216 Number of samples to generate. Default is 50.
217 endpoint : boolean, optional
218 If true, `stop` is the last sample. Otherwise, it is not included.
219 Default is True.
220 base : array_like, optional
221 The base of the log space. The step size between the elements in
222 ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform.
223 Default is 10.0.
224 dtype : dtype
225 The type of the output array. If `dtype` is not given, the data type
226 is inferred from `start` and `stop`. The inferred type will never be
227 an integer; `float` is chosen even if the arguments would produce an
228 array of integers.
229 axis : int, optional
230 The axis in the result to store the samples. Relevant only if start,
231 stop, or base are array-like. By default (0), the samples will be
232 along a new axis inserted at the beginning. Use -1 to get an axis at
233 the end.
234
235 .. versionadded:: 1.16.0
236
237
238 Returns
239 -------
240 samples : ndarray
241 `num` samples, equally spaced on a log scale.
242
243 See Also
244 --------
245 arange : Similar to linspace, with the step size specified instead of the
246 number of samples. Note that, when used with a float endpoint, the
247 endpoint may or may not be included.
248 linspace : Similar to logspace, but with the samples uniformly distributed

Callers 8

test_basicMethod · 0.90
test_start_stop_arrayMethod · 0.90
test_base_arrayMethod · 0.90
test_stop_base_arrayMethod · 0.90
test_dtypeMethod · 0.90
test_subclassMethod · 0.90
geomspaceFunction · 0.85

Calls 2

astypeMethod · 0.80
linspaceFunction · 0.70

Tested by 7

test_basicMethod · 0.72
test_start_stop_arrayMethod · 0.72
test_base_arrayMethod · 0.72
test_stop_base_arrayMethod · 0.72
test_dtypeMethod · 0.72
test_subclassMethod · 0.72