<html>
<head><title></title></head>
<body>
</body>
<script type="text/javascript">
var i = 0;
var j = 6;
var total_var = 7;
var new_number = 0;
//計算總樣本數
var totalcount = 0;
for (tmp=1;total_var>tmp;tmp++)
{
totalcount += tmp
}
var a = new Array(total_var)
var obj = new Array(totalcount);
a[0]= 8
a[1]= 3
a[2]= 0
a[3]= 2
a[4]= 15
a[5]= 45
a[6]= 73
var k;
var summary = 0;
//步驟 2. 計算總數
for (i;j>=i;i++)
{
k = i;
for (k;j>=k;k++)
{
obj[new_number] = a + a[k];
summary += (a + a[k])/ 2;
new_number += 1;
};
};
//跳出加總數字
alert(summary);
//步驟 3. 泡沫排序法..將樣本由小到大排序
var tmp;
for (i=0;totalcount>i;i++)
{
for (j=0;totalcount-1>=j;j++)
{
if (new Number(obj[j]) > new Number(obj[j+1]))
{
tmp = obj[j];
obj[j] = obj[j+1];
obj[j+1] = tmp;
};
};
};
var sortdata = "";
for (i=0;totalcount>i;i++)
{
sortdata += obj+"\n";
}
//跳出排序
alert(sortdata);
//步驟 4. 取得中位數 START
var mid_number;
if (totalcount/2 != 0)
{
mid_number = obj[(1+totalcount)/2];
}
else
{
mid_number = (obj[(totalcount)/2]+obj[(totalcount)/2+1])/2;
}
alert(mid_number);
//取得中位數 END
//步驟 5. 信賴區間????
var a = totalcount - 0.5 - (1.96 * Math.sqrt(total_var*(total_var+1)*(2*total_var+1)/24))
a = Math.floor(a)
var xx1 = a+1
var xx2 = totalcount-a
alert("["+xx1+","+xx2+"]")
//步驟 5. 信賴區間????
</script>
</html>