【发布时间】:2013-08-22 20:49:37
【问题描述】:
我是新来的, 目前我正在尝试用Java计算标准偏差(我已经用谷歌搜索了哈哈) 但我在让它工作时遇到了很多问题
我有十个用户输入的值,然后我必须计算标准差 到目前为止,我的理解感谢回复的人 是 我找到了数组的平均值 然后完成计算
double two = total[2];
double three = total[3];
double four = total[3];
double five = total[4];
double six = total[6];
double seven = total[7];
double eight = total[8];
double nine = total[9];
double ten = total[10];
double eleven = average_total;
mean = one + two + three + four + five + six + seven + eight + nine + ten + eleven;
mean = mean/11;
//one = one - mean;
//System.out.println("I really hope this prints out a value:" +one);
*/
//eleven = average_total - mean;
//eleven = Math.pow(average_total,average_total);
//stand_dev = (one + two + three + four + five + six + seven + eight + nine + ten + eleven);
//stand_dev = stand_dev - mean;
// stand_dev = (stand_dev - mean) * (stand_dev - mean);
// stand_dev = (stand_dev/11);
// stand_dev = Math.sqrt(stand_dev);
我的数据已经存储在一个包含 10 个值的数组中,但我不太确定 如何从数组中打印数据然后进行计算而不必在此处存储输入代码 我在其他地方操作过的数据
感谢您的宝贵时间,非常感谢 :)
【问题讨论】:
-
显示你目前拥有的代码。
-
双一 = 总计[1];双二=总计[2];双三=总计[3];双四=总计[3];双五=总计[4];双六=总计[6];双七 = 总计[7];双八=总计[8];双九 = 总计[9];双十 = 总计[10];双十一 = average_total;
-
平均 = 一 + 二 + 三 + 四 + 五 + 六 + 七 + 八 + 九 + 十 + 十一;平均值=平均值/11;十一 = average_total - 平均值;十一 = Math.pow(average_total,average_total); stand_dev =(一+二+三+四+五+六+七+八+九+十+十一); stand_dev = stand_dev - 意思; stand_dev = (stand_dev - mean) * (stand_dev - mean);站立开发 = (stand_dev/11-1); stand_dev = Math.sqrt(stand_dev);
-
抱歉,格式太差了
-
你在循环课上睡着了,对吧?
标签: java arrays standard-deviation