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));
}
}
Title | # Comments | Views | Activity |
---|---|---|---|
Windows phone Development | 11 | 27 | |
custome paging in C# & oracle using inline queries. | 12 | 36 | |
Any reason why this might be bad? | 7 | 40 | |
How would I write a message when there are no files to process in the foreach loop? | 5 | 42 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
17 Experts available now in Live!