Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

# Thread: Standard Deviation using Array

1. ## Standard Deviation using Array

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

2. ## Re: Standard Deviation using Array

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.

3. ## Re: Standard Deviation using Array

Originally Posted by JavaFreakSam
... calculate Standard Deviation using Array in simple way.... Please help
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:

1. Show the work that you did on the three numbers when you performed the pencil-and-paper calculations.

2. Show what you tried in Java.

3. Tell us exactly what you don't understand about how to get the answer.

Cheers!

Z