Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,12 @@
|
|||
sub sd (@a) {
|
||||
my $mean = @a R/ [+] @a;
|
||||
sqrt @a R/ [+] map (* - $mean)², @a;
|
||||
}
|
||||
|
||||
sub sdaccum {
|
||||
my @a;
|
||||
return { push @a, $^x; sd @a; };
|
||||
}
|
||||
|
||||
my &f = sdaccum;
|
||||
say f $_ for 2, 4, 4, 4, 5, 5, 7, 9;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
sub stddev($x) {
|
||||
sqrt
|
||||
( .[2] += $x²) / ++.[0]
|
||||
- ((.[1] += $x ) / .[0])²
|
||||
given state @;
|
||||
}
|
||||
|
||||
say .&stddev for <2 4 4 4 5 5 7 9>;
|
||||
Loading…
Add table
Add a link
Reference in a new issue