Use 1//2 instead of ((rat simp) 1 2)
[maxima.git] / share / translators / m2mj / test.mpl
blob6b1340839ed02cd19026d5bb37c3ecfb70bebe4d
1 # compute the standard deviation of a list of numbers
2 sigma := proc(data)
3 local mean,n,s,x;
4 n := nops(data);
5 if n < 2 then ERROR (`input must contain at least 2 values`) fi;
6 mean := 0;
7 for x in data do mean := mean + x od;
8 mean := mean/n;
9 s := 0;
10 for x in data do s := s + (x-mean)^2 od;
11 sqrt(s/(n-1))
12 end:
13 sigma([1,2,3,4,5,6]);
14 sigma([0.5,3.2,5.1]);
15 quit: