Commit 19f6ad06 authored by unknown's avatar unknown

fix stupid error in comments to VARIANCE+STD

parent 29624e32
...@@ -255,15 +255,15 @@ public: ...@@ -255,15 +255,15 @@ public:
variance(a) = variance(a) =
= sqrt ( sum (ai - avg(a))^2 / count(a) ) = sum (ai - avg(a))^2 / count(a) )
= sqrt ( sum (ai^2 - 2*ai*avg(a) + avg(a)^2) / count(a) ) = sum (ai^2 - 2*ai*avg(a) + avg(a)^2) / count(a)
= sqrt ( (sum(ai^2) - sum(2*ai*avg(a)) + sum(avg(a)^2))/count(a) ) = = (sum(ai^2) - sum(2*ai*avg(a)) + sum(avg(a)^2))/count(a) =
= sqrt ( (sum(ai^2) - 2*avg(a)*sum(a) + count(a)*avg(a)^2)/count(a) ) = = (sum(ai^2) - 2*avg(a)*sum(a) + count(a)*avg(a)^2)/count(a) =
= sqrt ( (sum(ai^2) - 2*sum(a)*sum(a)/count(a) + count(a)*sum(a)^2/count(a)^2 )/count(a) ) = = (sum(ai^2) - 2*sum(a)*sum(a)/count(a) + count(a)*sum(a)^2/count(a)^2 )/count(a) =
= sqrt ( (sum(ai^2) - 2*sum(a)^2/count(a) + sum(a)^2/count(a) )/count(a) ) = = (sum(ai^2) - 2*sum(a)^2/count(a) + sum(a)^2/count(a) )/count(a) =
= sqrt ( (sum(ai^2) - sum(a)^2/count(a))/count(a) ) = (sum(ai^2) - sum(a)^2/count(a))/count(a)
*/ */
class Item_sum_variance : public Item_sum_num class Item_sum_variance : public Item_sum_num
{ {
...@@ -294,6 +294,10 @@ public: ...@@ -294,6 +294,10 @@ public:
double val(); double val();
}; };
/*
standard_deviation(a) = sqrt(variance(a))
*/
class Item_sum_std :public Item_sum_variance class Item_sum_std :public Item_sum_variance
{ {
public: public:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment