I'm trying to implement a piece of code with Python3 that generates a list of n
equally spaced numbers (which may be rational) that range between two specified numbers.
For example:
if n = 3
, x = -1
and y = 1
, the result should be [-1,0,1]
.
My assumption is that this should use numpy's arange
with the step calculated from these three values, but I can't figure out the math. In this simple example, the step would be = 1, but if x = 0
and y = 1
, the step is .5
.