[Numpy-discussion] arange and floating point arguments
Fri Sep 14 11:01:34 CDT 2007
On 14/09/2007, Robert Kern <email@example.com> 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)
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
More information about the Numpy-discussion