logspace

Contents

logspace#

class saiunit.math.logspace(start, stop, num=50, endpoint=True, base=10.0, dtype=None)#

Return numbers spaced evenly on a log scale.

In linear space, the sequence starts at base ** start and ends with base ** stop in num steps. Because base ** x is dimensionless, start and stop must be dimensionless and the result is a plain array (never a Quantity).

Parameters:
  • start (Array | ndarray | number | bool) – base ** start is the starting value of the sequence. Must be dimensionless.

  • stop (Array | ndarray | number | bool) – base ** stop is the final value of the sequence (unless endpoint is False). Must be dimensionless.

  • num (Optional[int]) – Number of samples to generate. Default is 50.

  • endpoint (Optional[bool]) – If True, stop is the last sample. Otherwise, it is not included. Default is True.

  • base (Optional[float]) – The base of the log space. Default is 10.0.

  • dtype (Union[str, type[Any], dtype, SupportsDType, None]) – The type of the output array.

Returns:

samplesnum samples, equally spaced on a log scale.

Return type:

Array

Raises:

UnitMismatchError – If start or stop carries a non-trivial unit.

Examples

>>> import saiunit as u
>>> u.math.logspace(0, 2, 4)
Array([  1.       ,   4.6415887,  21.544348 , 100.       ], dtype=float32)