home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
turbopas
/
pas_sci.arc
/
MEANSTD.LIB
< prev
next >
Wrap
Text File
|
1985-07-21
|
573b
|
24 lines
procedure meanstd
(x : ary; {array of values}
length : integer;
var mean : real;
var std_dev : real);
var
i : integer;
sum_x,sum_sq : real;
begin {main}
sum_x:=0;
sum_sq:=0;
for i:=1 to length do
begin
sum_x:=sum_x+x[i];
sum_sq:=sum_sq+x[i]*x[i]
end;
mean:=sum_x/length;
std_dev:=sqrt((sum_sq-sqr(sum_x)/length)/(length-1))
end { procedure meanstd };