[squeak-dev] Re: statistics: standard deviation
Frank Shearar
frank.shearar at gmail.com
Wed Dec 5 17:45:13 UTC 2012
On 5 December 2012 17:38, Nicolas Cellier
<nicolas.cellier.aka.nice at gmail.com> wrote:
> 2012/12/5 glenpaling <slp5591 at me.com>:
>> I add these two methods to the math functions protocol of the Collections
>> class:
>>
>> variance
>>
>> ^(self - self average) squared average
>>
>> and
>>
>> standardDeviation
>>
>> ^self variance sqrt.
>>
>> Be careful with large collections integers as these methods will invoke
>> fraction arithmetic which is rather slow. In most cases it would be better
>> to force floating point.
>>
>>
>
> No, IMO the library shouldn't force anything but let the decision to the sender.
> Such information has a place in documentation.
Especially when forcing floats is as easy as (myCollection collect:
#asFloat) standardDeviation.
frank
> Nicolas
>
>>
>> --
>> View this message in context: http://forum.world.st/statistics-standard-deviation-tp4655159p4658151.html
>> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>>
>
More information about the Squeak-dev
mailing list
|