Skip to content

Instantly share code, notes, and snippets.

@JefClaes
Created January 18, 2015 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JefClaes/315fa7a3b66f10e73089 to your computer and use it in GitHub Desktop.
Save JefClaes/315fa7a3b66f10e73089 to your computer and use it in GitHub Desktop.
Averages are not good enough (4)
let standardDeviation input =
let avg = input |> Seq.average
let x = input |> Seq.map(fun x -> System.Math.Pow(float x - avg, float 2)) |> Seq.sum
let y = input |> Seq.length |> float
let variance = x / y
System.Math.Sqrt variance
// Average = 45.625; Standard Deviation = 20.87425148
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment