 
 
 
 
 
   
| 
mean::usage =
  "mean[list] returns the mean value of the elements of list."
variation::usage =
  "variation[list] returns the variation of the elements of list."
Begin["Private`"]
mean[l_List] := 
  Module[{n = Length[l], i}, Sum[l[[i]],{i,n}] / n]
variation[l_List] :=
  Module[{n, m, i}, 
        n = Length[l]; m=mean[l]; Sum[(l[[i]]-m)^2, {i,n}]/n]
End[]
 | 
Mathematica では C のように何かをするための専用プログラムを記述して、 コンパイルして実行するのではなく、知識を増やして賢くして行き、質問に答 えさせるという感じ。何か計算させるときは、○○関係の関数集 (パッケージ という) をシステムにロードして使う、という形態を取る。こういう場合、名 前をきちんと扱うのは重要になる。 (人間の知的活動でも、一つの名前が、状 況によって全く違う意味になることがあるが、文脈の違いを適当に認識するこ とによって使い分けている。)