16 lines
365 B
C#
16 lines
365 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace NSAnalysis
|
|
{
|
|
public static class EnumerableExtensions
|
|
{
|
|
public static double StandardDeviation(this IEnumerable<double> values)
|
|
{
|
|
double avg = values.Average();
|
|
double sum = values.Sum(d => Math.Pow(d - avg, 2));
|
|
return Math.Sqrt((sum) / (values.Count() - 1));
|
|
}
|
|
}
|
|
} |