Geomspace

Shipping
array_geomspace

numpy geomspace: num samples geometrically (log-) spaced between actual start and stop

Signature

Outputs

  • arrayArrayA 1-D Vector of num values in a geometric progression from start to stop.

Parameters

KeyTypeDefaultNotes
startfloat1.0First value (non-zero).
stopfloat1000.0Last value (non-zero, same sign as Start).
numint50Number of samples, spaced evenly on a log scale.
endpointbooleantrueWhen on, the last sample is exactly Stop.
unittextOptional physical unit for the resulting 1-D Vector.

Description

Geomspace is numpy.geomspace: Count samples forming a geometric progression (a constant ratio between neighbours) from Start to Stop. Unlike Logspace, you give the actual endpoints — not exponents.

Internally it exponentiates a linspace of : sign · exp(linspace(ln|start|, ln|stop|, num)), then pins both endpoints exactly. Because a geometric series cannot cross zero, Start and Stop must both be non-zero and share the same sign — a violation is a clean error. The result is a Vector that may carry a Unit.

Mathematics

Examples

Four points, decade-ish ratio

Start = 1, Stop = 1000, Count = 4 (ratio between neighbours).

Same-sign requirement

Start = 1, Stop = -1000 errors: a geometric series can't change sign or pass through zero.

Applications

  • A log-spaced frequency or wavelength axis given by its true endpoints.
  • Geometrically increasing time constants, step sizes, or annealing schedules.
  • Resistor/component E-series-style value grids with a fixed ratio.

Neat

Endpoints are pinned to the exact Start and Stop after the exp() round-trip, so ln→exp float error never nudges the first/last value off the requested bound.

Negative ranges are supported by factoring out the sign and working on |start|, |stop| in log space — as long as both share that sign.

Known issues

Start and Stop must be non-zero and same-sign (the series cannot cross zero) — otherwise it errors.

Count is capped at 100,000,000 samples.

See also

arrayvectorsourcenumpygeomspacegeometriclogarithmicstateless