[Numpy-discussion] Why arange has no stop-point opt-in?
Thu Dec 30 08:08:09 CST 2010
2010/12/30 Friedrich Romstedt <firstname.lastname@example.org>:
> 2010/12/30 K.-Michael Aye <email@example.com>:
>> I'm a bit puzzled that there seems just no way to cleanly code an
>> interval with evenly spaced numbers that includes the stop point given?
>> linspace offers to include the stop point, but arange does not?
>> Am I missing something? (I am aware, that I could do
>> arange(9,15.0001,0.1) but that's what I want to avoid!)
> Use numpy.linspace(9, 15, 7 * 10 + 1). FYI, there is also numpy.logspace().
Oh sorry, I overlooked that you're aware of the linspace functionality. Sorry.
I think opting in or opting out the end point in arange() is at even
rate, because it's in both cases the same unreliable (about including
or not including the end point). Because it might pick a) if opting
in a point just 1e-14 above so not opting in as desired and b) vice
verse if opting out, it might pick a point just 1e-14 below. But I
believe someone more educated about fp issues will give a more
More information about the NumPy-Discussion