comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: randomn problem
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: randomn problem [message #52949 is a reply to message #52948] Mon, 12 March 2007 09:07 Go to previous messageGo to previous message
Nigel Wade is currently offline  Nigel Wade
Messages: 286
Registered: March 1998
Senior Member
> askemer@gmail.com wrote:
>> Hi all,
>>
>> I was playing around with randomn and noticed some weird behavior:
>>
>> IDL> print, stddev(randomn(seed, 1e7))
>>
>> I consistently get back numbers around ~0.992. I've tried it on a
>> different computer, and the result was not exactly the same, but
>> similar. If I change 1e7 to 1e8, the problem gets worse, and I get
>> ~0.853. I've tried the syntax with floats, integers, and longs, and I
>> still get the same answer. Does anyone know what could be going on?
>>
>> -Andy
>>

Paolo Grigis wrote:

> The problem does not lie with randomn, but with
> stddev. If you compute it using double precision
> instead, the problem should solve itsef. Example:
>
> a=fltarr(3e7)
> a[0:3e7/2]=1.
>
> print,stddev(a)
> 0.528791
> print,stddev(a,/double)
> 0.50000000
>
> Ciao,
> Paolo
>

Something also changed between IDL 6.1 and IDL 6.2:

IDL Version 6.1 (linux x86 m32). (c) 2004, Research Systems, Inc.
IDL> print, stddev(randomn(seed,1e8))
% Compiled module: STDDEV.
% Compiled module: MOMENT.
1.00003

IDL Version 6.2 (linux x86 m32). (c) 2005, Research Systems, Inc.
IDL> print, stddev(randomn(seed,1e8))
% Compiled module: STDDEV.
% Compiled module: MOMENT.
0.970528

Maybe the algorithm has been changed to one which propogates more round-off
error?

--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: New IDLDE
Next Topic: Delete bad data and interplate the new data

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 23:52:37 PDT 2025

Total time taken to generate the page: 0.96142 seconds