Posted on 2006-11-22
I have to calculate the Variance of a user input in Java. I have to use this formula:
V(X) = E(X²) - (E(X))²
The user input may consist of an arbitrary amount of integers from 1 to 5.
The thing is that I have absolutely no clue how to code this formula. So if anyone can help me it would be really great.
The best solution for me would be a code snipplet which calculates the variance.
Nevertheless if you can tell me how the formula really works and what the variables used in the code mean.
This would be definitely the best thing.