>>> np.arange(0, 10, 2)
array([0, 2, 4, 6, 8])
# as above, cast to complex
>>> np.arange(0 + 0j, 10 + 0j, 2 + 0j)
array([], dtype=complex128) #what?
# bizarre input needed to give expected output
>>> np.arange(0 + 0j, 10 + 10j, 2 + 0j)
# array([ 0.+0.j, 2.+0.j, 4.+0.j, 6.+0.j, 8.+0.j])
For some reason, it deliberately computes len as (c14792d)
c_len = (start - stop) / step
len = min(ceil(c_len.real), ceil(c_len.imag))
which for real-only values, gives 0.
I think a better approach would be to use one of
-
ceil(abs(c_len)) - has semantics "use the circle centered at start and passing through end" as the end point
-
ceil(c_len.real) - has semantics "use the projection of end onto the line start + k*step as the endpoint"
-
above with assert c_len.imag == 0 - requires that end lies on that line, but prone to rounding error
-
Project step onto the line between start and end, and use that instead
I like the look of 2 and 4
For some reason, it deliberately computes len as (c14792d)
which for real-only values, gives
0.I think a better approach would be to use one of
ceil(abs(c_len))- has semantics "use the circle centered atstartand passing throughend" as the end pointceil(c_len.real)- has semantics "use the projection ofendonto the linestart + k*stepas the endpoint"above with
assert c_len.imag == 0- requires thatendlies on that line, but prone to rounding errorProject
steponto the line betweenstartandend, and use that insteadI like the look of 2 and 4