repo.or.cz
/
maxima.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Use 1//2 instead of ((rat simp) 1 2)
[maxima.git]
/
share
/
translators
/
m2mj
/
test.mpl
blob
6b1340839ed02cd19026d5bb37c3ecfb70bebe4d
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
: