Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
28
Task/Statistics-Basic/PicoLisp/statistics-basic.l
Normal file
28
Task/Statistics-Basic/PicoLisp/statistics-basic.l
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
(seed (time))
|
||||
|
||||
(scl 8)
|
||||
|
||||
(de statistics (Cnt . Prg)
|
||||
(prinl Cnt " numbers")
|
||||
(let (Sum 0 Sqr 0 Hist (need 10 NIL 0))
|
||||
(do Cnt
|
||||
(let N (run Prg 1) # Get next number
|
||||
(inc 'Sum N)
|
||||
(inc 'Sqr (*/ N N 1.0))
|
||||
(inc (nth Hist (inc (/ N 0.1)))) ) )
|
||||
(let M (*/ Sum Cnt)
|
||||
(prinl "Mean: " (round M))
|
||||
(prinl "StdDev: "
|
||||
(round
|
||||
(sqrt
|
||||
(- (*/ Sqr Cnt) (*/ M M 1.0))
|
||||
1.0 ) ) ) )
|
||||
(for (I . H) Hist
|
||||
(prin (format I 1) " ")
|
||||
(do (*/ H 400 Cnt) (prin '=))
|
||||
(prinl) ) ) )
|
||||
|
||||
(for I (2 4 6)
|
||||
(statistics (** 10 I)
|
||||
(rand 0 (dec 1.0)) )
|
||||
(prinl) )
|
||||
Loading…
Add table
Add a link
Reference in a new issue