Post · 2 min read· pp. 875–876

aerosandbox.numpy.spacing

Functions

linspace([start, stop, num])Returns evenly spaced numbers over a specified interval.
cosspace([start, stop, num])Makes a cosine-spaced vector.
sinspace([start, stop, num, reverse_spacing])Makes a sine-spaced vector. By default, bunches points near the start.
logspace([start, stop, num])Return numbers spaced evenly on a log scale.
geomspace([start, stop, num])Return numbers spaced evenly on a log scale (a geometric progression).

Module Contents

aerosandbox.numpy.spacing.linspace(start=0.0, stop=1.0, num=50) : Returns evenly spaced numbers over a specified interval.

code
See syntax here: <https://numpy.org/doc/stable/reference/generated/numpy.linspace.html>

Parameters:
:   - **start** (*float*) –
    - **stop** (*float*) –
    - **num** (*int*) –

aerosandbox.numpy.spacing.cosspace(start=0.0, stop=1.0, num=50) : Makes a cosine-spaced vector.

code
Cosine spacing is useful because these correspond to Chebyshev nodes: <https://en.wikipedia.org/wiki/Chebyshev_nodes>

To learn more about cosine spacing, see this: <https://youtu.be/VSvsVgGbN7I>

Parameters:
:   - **start** (*float*) – Value to start at.
    - **end** – Value to end at.
    - **num** (*int*) – Number of points in the vector.
    - **stop** (*float*) –

aerosandbox.numpy.spacing.sinspace(start=0.0, stop=1.0, num=50, reverse_spacing=False) : Makes a sine-spaced vector. By default, bunches points near the start.

code
Sine spacing is exactly identical to half of a cosine-spaced distrubution, in terms of relative separations.

To learn more about sine spacing and cosine spacing, see this: <https://youtu.be/VSvsVgGbN7I>

Parameters:
:   - **start** (*float*) – Value to start at.
    - **end** – Value to end at.
    - **num** (*int*) – Number of points in the vector.
    - **reverse\_spacing** (*bool*) – Does negative-sine spacing. In other words, if this is True, the points will be bunched near
    - **start.** (*the stop rather than at the*) –
    - **stop** (*float*) –

Points are bunched up near the start of the interval by default. To reverse this, use the reverse\_spacing
parameter.

aerosandbox.numpy.spacing.logspace(start=0.0, stop=1.0, num=50) : Return numbers spaced evenly on a log scale.

code
See syntax here: <https://numpy.org/doc/stable/reference/generated/numpy.logspace.html>

Parameters:
:   - **start** (*float*) –
    - **stop** (*float*) –
    - **num** (*int*) –

aerosandbox.numpy.spacing.geomspace(start=1.0, stop=10.0, num=50) : Return numbers spaced evenly on a log scale (a geometric progression).

code
This is similar to logspace, but with endpoints specified directly.

See syntax here: <https://numpy.org/doc/stable/reference/generated/numpy.geomspace.html>

Parameters:
:   - **start** (*float*) –
    - **stop** (*float*) –
    - **num** (*int*) –