[Numpy-discussion] step paramter for linspace

Sebastian Berg sebastian@sipsolutions....
Fri Mar 1 09:27:29 CST 2013


On Fri, 2013-03-01 at 15:07 +0000, Henry Gomersall wrote:
> On Fri, 2013-03-01 at 10:01 -0500, Alan G Isaac wrote:
> > On 3/1/2013 9:32 AM, Henry Gomersall wrote:
> > > there should be an equivalent for floats that
> > > unambiguously returns a range for the half open interval
> > 
> > 
> > If I've understood you:
> > start + stepsize*np.arange(nsteps)
> 
> yes, except that nsteps is computed for you, otherwise you could just
> use linspace ;)

If you could just use linspace, you should use linspace (and give it a
step argument) in my opinion, but I don't think you meant that ;).

linspace holds start and stop exact and guarantees that you actually get
to stop. Even a modified/new arange will never do that, but I think many
use arange like that and giving linspace a step argument could migrate
that usage (which is simply ill defined for arange) to it. That might
give an error once in a while, but that should be much less often and
much more enlightening then a sudden "one value too much".

I think the accuracy requirements for the step for linspace can be
relaxed enough probably, though I am not quite certain yet as to how
(there is a bit of a trade off/problem when you get to a very large
number of steps).

> 
> hen
> 
> 
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
> 




More information about the NumPy-Discussion mailing list