The revolutionary project management tool is here! Plan visually with a single glance and make sure your projects get done.
public static double StandardDeviation(List<double> num)
{
double SumOfSqrs = 0;
double avg = num.Average();
for (int i = 0; i < num.Count; i++)
{
SumOfSqrs += Math.Pow(((double)num[i] - avg), 2);
}
double n = (double)num.Count;
if (n == 1)
{
return Math.Sqrt(SumOfSqrs);
}
else
{
return Math.Sqrt(SumOfSqrs / (n - 1));
}
}
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.