Arange
Shippingarray_arangenumpy arange: a half-open [start, stop) sequence spaced by step
Signature
Outputs
arrayArray— A 1-D Vector of evenly stepped values over the half-open interval [start, stop).
Parameters
| Key | Type | Default | Notes |
|---|---|---|---|
start | float | 0.0 | First value (inclusive). |
stop | float | 10.0 | End value (EXCLUSIVE, like numpy.arange). |
step | float | 1.0 | Spacing between values; must be non-zero (may be negative to count down). |
unit | text | Optional physical unit for the resulting 1-D Vector. |
Description
Arange is numpy.arange: a 1-D sequence over the half-open interval spaced by Step. The stop value is excluded; the length is (clamped at ). A negative Step counts down.
Because it is index-driven () rather than division-based, Arange is exact for integer steps but can accumulate float drift near the endpoint for fractional steps — prefer Linspace when you need a precise, count-controlled endpoint. Step or a non-finite argument is an error. The output is always a Vector and may carry a Unit.
Mathematics
Examples
Integer index vector
Start = 0, Stop = 5, Step = 1 → the Vector (note 5 is excluded).
Counting down
Start = 10, Stop = 0, Step = -2 → .
Applications
- Generating integer index or sample-number axes.
- Building a time or frequency axis with a known fixed spacing.
- Driving a loop-like parameter sweep with a fixed increment.
Neat
Length is computed with a ceil, so a non-integer span like arange(0, 1, 0.3) yields ⌈1/0.3⌉ = 4 samples ([0, 0.3, 0.6, 0.9]) — exactly numpy's rule.
Values are generated as start + i·step (multiply, not repeated add), which keeps rounding error bounded per element instead of accumulating.
Known issues
The exclusive endpoint plus fractional steps can make the last element land just short of / past an expected value due to float rounding — use Linspace for a guaranteed endpoint.
Step = 0 or non-finite start/stop/step is an error, not an empty array.