Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Java 

Standard deviation formula

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:
Code
standardDeviation = Math.sqrt( ((sumOfsquares) - (1.0/count) * (Math.pow(ave,2))) / (count - 1) );
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.
[Image: NV87NMr.png]
The average(ave) should be replaced with the summation of all X terms, since that's what the symbol denotes
(Oct 7, 2014 06:01 PM)King Yolo Wrote:  The average(ave) should be replaced with the summation of all X terms, since that's what the symbol denotes

Sure enough, can't believe I didn't spot that, had it mis-labeled in my notes which translated into my code.

Thank-you!
[Image: NV87NMr.png]


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by The PactJul 13, 2017 04:35 PM 3 150 Jul 13, 2017 04:35 PM
Last Post: Goodies
[Python] by GerymcJul 3, 2017 09:08 AM 5 197 Jul 3, 2017 09:08 AM
Last Post: arkoydas
[C] by jjblazeOct 4, 2015 11:11 PM 5 179 Oct 4, 2015 11:11 PM
Last Post: Aus10