title: How to calculate circular standard deviation in Java?
body: <p>I have found some information about mean and standard deviation of circular statistics. Namely, <a href="http://en.wikipedia.org/wiki/Directional_statistics" rel="nofollow">Wikipedia</a></p>
  
  <p>However I am not clear how I can code this in Java.</p>
  
  <p>For circular mean I have tried something like:</p>
  
  <pre><code>for double radian : radians then
      cos += Math.cos(radian)
      sin += Math.sin(radian)
  next
  
  atan2 = Math.atan2(cos, sin)
  
  if atan2 &lt; 0 then
      atan2 += 2 * PI
  end if
  
  mean = Math.toDegrees(atan2) % 360
  </code></pre>
  
  <p>This seems to give me a neat result, but for the standard deviation I am very unclear.</p>
  
  <p>Any help would be appreciated.</p>
  
  <p>Matt</p>