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

Home » Public Forums » archive » Re: Huh?? Stddev went crazy!
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Huh?? Stddev went crazy! [message #59853] Wed, 16 April 2008 12:41
Conor is currently offline  Conor
Messages: 138
Registered: February 2007
Senior Member
On Apr 16, 3:31 pm, pgri...@gmail.com wrote:
> Conor wrote:
>> I'd like to see someone explain this one. My stddev function
>> apparently lost all grasp on reality?
>
>> IDL> print,stddev([1,2,3,4,5])
>> 3.07421 3.24566 3.08206 3.26360 2.97446
>> IDL> print,stddev([1.,2.,3.,4.,5.])
>> 3.07421 3.24566 3.08206 3.26360 2.97446
>> IDL> print,stddev([1.,2.])
>> 3.07421 3.24566
>
>> IDL> print,stddev(findgen(32))
>> 2.99513 3.07421 3.24566 3.08206 3.26360
>> 2.97446 2.96850 3.04474 2.66875 2.77181
>> 2.83465
>> 2.77395 2.77370 2.87829 2.84716 2.86982
>> 2.98503 2.93160 2.77602 2.59318 2.83169
>> 3.30869
>> 2.67353 3.15337 3.19076 3.19499 2.96050
>> 3.13871 2.61707 2.77854 3.12603 3.20029
>
>> Finally I did this:
>
>> IDL> .reset
>
>> And it returned to normal! Yeah!
>
>> IDL> print,stddev(findgen(32))
>> % Compiled module: STDDEV.
>> % Compiled module: MOMENT.
>> 9.38083
>> IDL> res = findgen(10,10)
>> IDL> print,stddev(res)
>> 29.0115
>
>> I have not been able to reproduce the crazy behavior since (not that
>> I've tried very hard). Still, it's rather worrisome if the behavior
>> of a built in function isn't reliable!!
>
> Well, here I think I should point out that "stddev" is not a "built-
> in"
> function, but a "library" function (meaning it is distributed as
> a .pro file).
> Hence, anybody can override it by compiling a different function
> called stddev. On the other hand, built-in functions
> cannot be overridden in that way.
>
> Paolo

I think you guys have solved it! I guess that wasn't that hard... I
don't know for sure but it is very likely that I had an array named
stddev. I had never realized that could create a potential conflict!
I went ahead and put compile_opt IDL2 in my startup file, so hopefully
I won't have to worry about this anymore! Now I know what to look for
though...
Re: Huh?? Stddev went crazy! [message #59854 is a reply to message #59853] Wed, 16 April 2008 12:31 Go to previous message
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
Conor wrote:
> I'd like to see someone explain this one. My stddev function
> apparently lost all grasp on reality?
>
> IDL> print,stddev([1,2,3,4,5])
> 3.07421 3.24566 3.08206 3.26360 2.97446
> IDL> print,stddev([1.,2.,3.,4.,5.])
> 3.07421 3.24566 3.08206 3.26360 2.97446
> IDL> print,stddev([1.,2.])
> 3.07421 3.24566
>
> IDL> print,stddev(findgen(32))
> 2.99513 3.07421 3.24566 3.08206 3.26360
> 2.97446 2.96850 3.04474 2.66875 2.77181
> 2.83465
> 2.77395 2.77370 2.87829 2.84716 2.86982
> 2.98503 2.93160 2.77602 2.59318 2.83169
> 3.30869
> 2.67353 3.15337 3.19076 3.19499 2.96050
> 3.13871 2.61707 2.77854 3.12603 3.20029
>
> Finally I did this:
>
> IDL> .reset
>
> And it returned to normal! Yeah!
>
> IDL> print,stddev(findgen(32))
> % Compiled module: STDDEV.
> % Compiled module: MOMENT.
> 9.38083
> IDL> res = findgen(10,10)
> IDL> print,stddev(res)
> 29.0115
>
> I have not been able to reproduce the crazy behavior since (not that
> I've tried very hard). Still, it's rather worrisome if the behavior
> of a built in function isn't reliable!!

Well, here I think I should point out that "stddev" is not a "built-
in"
function, but a "library" function (meaning it is distributed as
a .pro file).
Hence, anybody can override it by compiling a different function
called stddev. On the other hand, built-in functions
cannot be overridden in that way.

Paolo
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Huh?? Stddev went crazy!
Next Topic: Re: TGIF

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

Current Time: Wed Oct 08 19:15:55 PDT 2025

Total time taken to generate the page: 0.00574 seconds