in reply to How do I get the root mean square of a list?
Can I improve on this?sub std_dev($) { my $listref = $_[0]; my $avg = avg $listref; sqrt(sum([map{($avg-$_)*($avg-$_)}@{$listref}])/@{$listref}); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Answer: How do I get the root mean square of a list?
by MeowChow (Vicar) on Jun 04, 2001 at 20:36 UTC | |
by tilly (Archbishop) on Jun 04, 2001 at 21:15 UTC | |
by princepawn (Parson) on Jun 04, 2001 at 21:16 UTC |