How do I make a historgram, find the mean & SD using an array???

Hi,
If someone can help me, Id really appreciate it. The task is to input numbers (seperated by commas) into a textarea and then when the user clicks "plot" the mean and standard deviation appear in the appropriate textareas. In addition, a histogram is constructed from the numbers in the array. I have some code but it does not seem to work.

Can someone give me some tips. I am new at all this stuff.




David's Computer Program






var A = new Array();
var freq = new Array();

var A = s.split(",");

var mean;
var sum=0;


A = document.davidForm.main1.value.split(",");


function clearMainScreen() {
window.document.david.main1.value = "";
}

fucntion displayAvg() {
var mean = document.davidForm.main1.value;
for (var i = 0; i = A.length-1; i++) {
A[i] = parseInt(A[i]);
sum = sum + A[i];
}
mean = (sum / A.length);
window.alert("mean");
}


function standardDeviation (){
var smsq = sum+sum
var stdr = Math.sqrt((smsq-smsq/A.length)/A.length-1))

for (var i=0; i=0 && A{i} <=9{
freq[0]=freq[0]+1
}
}

var bin = Math.floor(A[i]/10);

freq[bin] = freq[bin]+1


Math.random

for (var i=0; i<A.length; i++){
A[i]=Math.round(Math.round( )*100)
}


</script>







Welcome to David's Amazing Webpage














image
image
image
image
image
image
image
image
image
image




Mean

Standard Deviation







Comments

  • Yeah I am also interested as to how to do this. So if anyone knows how to do this please reply!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion