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

Function geomspace

numpy/core/function_base.py:308–462  ·  view source on GitHub ↗

Return numbers spaced evenly on a log scale (a geometric progression). This is similar to `logspace`, but with endpoints specified directly. Each output sample is a constant multiple of the previous. .. versionchanged:: 1.16.0 Non-scalar `start` and `stop` are now supporte

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

Source from the content-addressed store, hash-verified

306
307@array_function_dispatch(_geomspace_dispatcher)
308def geomspace(start, stop, num=50, endpoint=True, dtype=None, axis=0):
309 """
310 Return numbers spaced evenly on a log scale (a geometric progression).
311
312 This is similar to `logspace`, but with endpoints specified directly.
313 Each output sample is a constant multiple of the previous.
314
315 .. versionchanged:: 1.16.0
316 Non-scalar `start` and `stop` are now supported.
317
318 Parameters
319 ----------
320 start : array_like
321 The starting value of the sequence.
322 stop : array_like
323 The final value of the sequence, unless `endpoint` is False.
324 In that case, ``num + 1`` values are spaced over the
325 interval in log-space, of which all but the last (a sequence of
326 length `num`) are returned.
327 num : integer, optional
328 Number of samples to generate. Default is 50.
329 endpoint : boolean, optional
330 If true, `stop` is the last sample. Otherwise, it is not included.
331 Default is True.
332 dtype : dtype
333 The type of the output array. If `dtype` is not given, the data type
334 is inferred from `start` and `stop`. The inferred dtype will never be
335 an integer; `float` is chosen even if the arguments would produce an
336 array of integers.
337 axis : int, optional
338 The axis in the result to store the samples. Relevant only if start
339 or stop are array-like. By default (0), the samples will be along a
340 new axis inserted at the beginning. Use -1 to get an axis at the end.
341
342 .. versionadded:: 1.16.0
343
344 Returns
345 -------
346 samples : ndarray
347 `num` samples, equally spaced on a log scale.
348
349 See Also
350 --------
351 logspace : Similar to geomspace, but with endpoints specified using log
352 and base.
353 linspace : Similar to geomspace, but with arithmetic instead of geometric
354 progression.
355 arange : Similar to linspace, with the step size specified instead of the
356 number of samples.
357 :ref:`how-to-partition`
358
359 Notes
360 -----
361 If the inputs or dtype are complex, the output will follow a logarithmic
362 spiral in the complex plane. (There are an infinite number of spirals
363 passing through two points; the output will follow the shortest such path.)
364
365 Examples

Callers 9

test_basicMethod · 0.90
test_nan_interiorMethod · 0.90
test_complexMethod · 0.90
test_dtypeMethod · 0.90
test_start_stop_arrayMethod · 0.90
test_subclassMethod · 0.90

Calls 6

asanyarrayFunction · 0.85
logspaceFunction · 0.85
astypeMethod · 0.80
result_typeFunction · 0.70
anyMethod · 0.45
dtypeMethod · 0.45

Tested by 9

test_basicMethod · 0.72
test_nan_interiorMethod · 0.72
test_complexMethod · 0.72
test_dtypeMethod · 0.72
test_start_stop_arrayMethod · 0.72
test_subclassMethod · 0.72