Hi all, I am new to JAVA. So, can you kindly help me with a Program?
# I want to write a program to calculate Standard Deviation using Array in simple way.... Please help
Printable View
Hi all, I am new to JAVA. So, can you kindly help me with a Program?
# I want to write a program to calculate Standard Deviation using Array in simple way.... Please help
Hi and welcome to the forum.
You should have read the sticky at the top of the forum titled "This Forum is for Saying Hi, not for Asking Technical Questions (READ BEFORE POSTING)", and the announcements page containing other important forum information.
Thread moved from member introductions.
How would you calculate the Standard Deviation of the values by "hand"?
Forget Java for a moment. Get a pencil and some paper.
Suppose I have three numbers: 1.0, 2.0, 3.0
What is the Standard Deviation of that set of numbers? Calculate it "by hand." I picked a small set of numbers with values that might even let you do the calculation without a calculator. It should only take a minute or two.
Now, back to Java. I want to make a program that handles numbers in an array of any size, but for starters, assume that we have an array, x, of doubles whose values are
x[0] = 1.0
x[1] = 2.0
x[2] = 3.0
Write a Java loop that performs the same calculations that you did with pencil and paper. It can be done with one loop, but depending on your approach to the problem, you might even need two loops. The important thing is to make the program go through exactly the same sequence of operations that you did by hand. Then incorporate that loop into a Java main() function.
If you don't know how to do it with pencil and paper, find a reference (class notes or textbook or Standard Deviation - wikipedia or whatever...) Then do it with pencil and paper.
If you don't see the connection between pencil and paper and java, then post again.
But, when you post again:
- Show the work that you did on the three numbers when you performed the pencil-and-paper calculations.
- Show what you tried in Java.
- Tell us exactly what you don't understand about how to get the answer.
Cheers!
Z