On Fri, 2013-03-01 at 13:44 +0100, Sebastian Berg wrote:
On Fri, 2013-03-01 at 12:33 +0000, Henry Gomersall wrote:
On Fri, 2013-03-01 at 13:25 +0100, Sebastian Berg wrote:
there has been a request on the issue tracker for a step parameter to linspace. This is of course tricky with the imprecision of floating point numbers.
How is that different to arange? Either you specify the number of points with linspace, or you specify the step with arange. Is there a third option?
My usual hack to deal with the numerical bounds issue is to add/subtract half the step.
There is not much. It does that half step logic for you, and you actually know that the end point is exact (since linspace makes sure of that).
In arange, the start and step are exact. In linspace the start and stop are exact (even with a given step, it would vary on the order of floating point accuracy).
Maybe the larger point is the hope that by adding this to linspace it is easier to get new users to use it and avoid pitfalls of arange with floating points when you are not aware of that half step thing.
That said, I am honestly not sure this is worth it. I guess I might use it once in a while, but overall probably hardly at all and it is easy to do something else...
Henry
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion