MCPcopy
hub / github.com/numpy/numpy / geomspace

Function geomspace

numpy/_core/function_base.py:312–453  ·  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. Parameters ---------- start : array_like The starting value of th

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

Source from the content-addressed store, hash-verified

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

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
result_typeFunction · 0.85
logspaceFunction · 0.85
astypeMethod · 0.80
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

Used in the wild real call sites across dependent graphs

searching dependent graphs…