From: Robert K. <rob...@gm...> - 2006-02-28 19:42:59
|
Steve Schmerler wrote: > Hi > > I've a machine where I used Numeric until now. Does the following > behaviour also occur with numpy? > > > In [38]: Numeric.__version__ > Out[38]: '23.8' > > In [39]: a = arange(0, 0.005, 0.00001); len(a) > Out[39]: 500 > > In [40]: a = arange(0, 0.005, 0.000001); len(a) > Out[40]: 5001 > > Shouldn't len(a)%10 == 0 in these cases? Yes. Floating point is weird. http://projects.scipy.org/scipy/numpy/ticket/8 Use numpy.linspace() for reliable results. I think matplotlib exposes linspace(), too. -- Robert Kern rob...@gm... "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter |