Oct 7, 2014 05:55 PM
(This post was last modified: Oct 7, 2014 05:57 PM by Arrakis.)
I'm having trouble converting this particular standard deviation formula into java.
[IMG]http://i1049.photobucket.com/albums/s387/brookpc/0ea557798a29b25defdddc165b1371dc_zps0c701b0b.png[/IMG]
I know that there is a better formula to use, but this is the one I need to use.
Here is what I have:
Note that ave = average, and count = n.
When I input the numbers 13,23,12,44,55 I get a rounded 37.52 returned which I know is incorrect.
I'm sure the answer is right in front of me, but it always helps to have a second set of eyes.
[IMG]http://i1049.photobucket.com/albums/s387/brookpc/0ea557798a29b25defdddc165b1371dc_zps0c701b0b.png[/IMG]
I know that there is a better formula to use, but this is the one I need to use.
Here is what I have:
Code
standardDeviation = Math.sqrt( ((sumOfsquares) - (1.0/count) * (Math.pow(ave,2))) / (count - 1) );When I input the numbers 13,23,12,44,55 I get a rounded 37.52 returned which I know is incorrect.
I'm sure the answer is right in front of me, but it always helps to have a second set of eyes.



![[Image: NV87NMr.png]](https://i.imgur.com/NV87NMr.png)
