On 14/09/2007, Robert Kern <[EMAIL PROTECTED]> wrote:
> Ed Schofield wrote:
> > Using arange in this way is a fundamentally unreliable thing to do,
> > but is there anything we want to do about this?
>
> Tell people to use linspace(). Yes, it does a slightly different thing; that's
> why it works. Most uses of floating point arange() can be cast using 
> linspace()
> more reliably.

I would like to point out in particular that numpy's linspace can
leave out the last point (something I often want to do):

Definition:     linspace(start, stop, num=50, endpoint=True, retstep=False)
Docstring:
    Return evenly spaced numbers.

    Return num evenly spaced samples from start to stop.  If
    endpoint is True, the last sample is stop. If retstep is
    True then return the step value used.

This is one of those cases where "from pylab import *" is going to
bite you, though, because its linspace doesn't. You can always fake it
with linspace(a,b,N+1)[:-1].

Anne
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to