//Ave=(x1+x2+x3+...+xn)/xn
if (data != undefined) {
if (this.datam.Ave != undefined) {
this._value = this.datam.Ave.toString(this._system);
} else {
if (this.datam.Sum == undefined) {
this.getSum();
}
this.datam.Ave = this.datam.Sum/this.data.length;
this._value = this.datam.Ave.toString(this._system);
}
this.isnew = 1;
this.broadMessage("Ave");
}
}
public function Ave2() { //求均方值
//Ave2=Sum2/n
if (this.data != undefined) {
if (this.datam.Ave2 != undefined) {
this._value = this.datam.Ave2.toString(this._system);
} else {
if (this.datam.Sum2 == undefined) {
this.getSum2();
}
this.datam.Ave2 = this.datam.Sum2/this.data.length;
this._value = this.datam.Ave2.toString(this._system);
}
this.isnew = 1;
this.broadMessage("Ave2");
}
}
public function Sum() { //求数据和
//Sum=x1+x2+x3+...+xn
if (data != undefined) {
if (this.datam.Sum != undefined) {
this._value = this.datam.Sum.toString(this._system);
} else {
this.getSum();
this._value = this.datam.Sum.toString(this._system);
}
this.isnew = 1;
this.broadMessage("Sum");
}
}
public function Sum2() { //求数据平方和
//Sum2=x1*x1+x2*x2+x3*x3+...+xn*xn
if (data != undefined) {
if (this.datam.Sum2 != undefined) {
this._value = this.datam.Sum2.toString(this._system);
} else {
this.getSum2();
this._value = this.datam.Sum2.toString(this._system);
}
this.isnew = 1;
this.broadMessage("Sum2");
}
}
public function S() { //求总体参数为n的标准差
//S=Math.sqrt((Sum2-n*Ave*Ave)/n)
if (data != undefined) {
if (this.datam.S != undefined) {
this._value = this.datam.S.toString(this._system);
} else {
if (this.datam.Ave == undefined) {
//计算Ave
if (this.datam.Sum == undefined) {
this.getSum();
}
this.datam.Ave = this.datam.Sum/this.data.length;
}
//计算Sum2
if (datam.Sum2 == undefined) {
this.getSum2();
}
//计算S
this.datam.S = Math.sqrt((this.datam.Sum2-this.data.length*this.datam.Ave*this.datam.Ave)/this.data.length);
this._value = this.datam.S.toString(this._system);
}
this.isnew = 1;
this.broadMessage("S");
}
}
public function S2() { //求总体参数为n-1的标准差
//S=Math.sqrt((Sum2-n*Ave*Ave)/(n-1))
if (data != undefined) {
if (this.datam.S2 != undefined) {
this._value = this.datam.S2.toString(this._system);
} else {
if (this.datam.Ave == undefined) {
//计算Ave
if (this.datam.Sum == undefined) {
this.getSum();
}
this.datam.Ave = this.datam.Sum/this.data.length;
}
//计算Sum2
if (datam.Sum2 == undefined) {
this.getSum2();
}
//计算S
this.datam.S2 = Math.sqrt((this.datam.Sum2-this.data.length*this.datam.Ave*this.datam.Ave)/(this.data.length-1));
this._value = this.datam.S2.toString(this._system);
}
this.isnew = 1;
this.broadMessage("S2");
}
}
public function Data() { //添加数据
if (this.data != undefined) {
if (this._system == 10) {
this.data.push(Number(_value));
} else {
this.data.push(parseInt(_value, _system));
}
this.datam = {Ave:undefined, Ave2:undefined, Sum:undefined, Sum2:undefined, S:undefined, S2:undefined};
this.isnew = 1;
this.broadMessage("Data");
}
}
public function load(n:Number) { //将数据显示在显示框中
if (this.data != undefined) {
this._value = this.data[n].toString(this._system);
this.isnew = 1;
this.broadMessage("load");
}
}
public function clear(n:Number) {
//清除数据 if (this.data != undefined) {
if (n == undefined) {
this.data.splice(n, 1);
} else {
this.data = [];
}
this.isnew = 1;
this.broadMessage("clear");
}
}
public function get hasData():Boolean {
return (this.data == undefined);
}
public function get n():Number {
return this.data.length;
}
}


| · 你会让人一见钟情吗 |
| · 搞笑CS版少女初夜 |
| · 超级女生李宇春终结版 |
| · 智力大挑战连连看 |
| · 美眉换装小游戏合集 |
| · 无与伦比周杰伦火热MTV |
| · 其卡通小奖赛发挥你创意 |
| · 齐达内铁头VS马特拉奇 |
| · ShowGood经典爆笑三国 |
| · 小破孩动画专区 |
| 关于腾讯 | About Tencent | 服务条款 | 广告服务 | 腾讯招聘 | 腾讯公益 | 客服中心 | 网站导航 | |
| Copyright © 1998 - 2008 Tencent Inc. All Rights Reserved | ![]() |
| 腾讯公司 版权所有 | |