---
jupyter:
  jupytext:
    text_representation:
      extension: .Rmd
      format_name: rmarkdown
      format_version: '1.2'
      jupytext_version: 1.11.5
  kernelspec:
    display_name: Python 3 (ipykernel)
    language: python
    name: python3
---

# NumPy arange

[`arange`](https://numpy.org/doc/stable/reference/generated/numpy.arange.html)
in NumPy is very like the Python
[`range`](https://docs.python.org/3/library/stdtypes.html#range)
callable with two important differences:

* `arange` returns an array rather than a `range` instance;

* `arange` arguments can be floating point values.

```{python}
import numpy as np
```

```{python}
np.arange(4, 11, 2)
```

```{python}
np.arange(4, 11, 0.5)
```

Because `arange` returns arrays, you can use NumPy element-wise operations
to multiply by the step size and add a start value.  This is one way to create
equally spaced vectors
([`np.linspace`](https://numpy.org/doc/stable/reference/generated/numpy.linspace.html)
is another):

```{python}
np.arange(10) * 0.5 + 4
```
