SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: Steve S. <el...@gm...> - 2006年02月28日 19:32:08
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?
cheers,
steve
-- 
Random number generation is the art of producing pure gibberish as 
quickly as possible.
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
From: Alan G I. <ai...@am...> - 2006年02月28日 19:47:34
On 2006年2月28日, Steve Schmerler apparently wrote:=20
> In [39]: a =3D arange(0, 0.005, 0.00001); len(a) Out[39]:=20
> 500=20
> In [40]: a =3D arange(0, 0.005, 0.000001); len(a)=20
> Out[40]: 5001=20
> Shouldn't len(a)%10 =3D=3D 0 in these cases?=20
Use numpy.linspace:
linspace(start, stop, num=3D50, endpoint=3DTrue, retstep=3DFalse)
 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.
Cheers,
Alan Isaac
PS http://docs.python.org/tut/node16.html
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /