Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,22 @@
|
|||
/pythamean{
|
||||
/x exch def
|
||||
/sum 0 def
|
||||
/prod 1 def
|
||||
/invsum 0 def
|
||||
/i 1 def
|
||||
|
||||
x{
|
||||
/sum sum i add def
|
||||
/prod prod i mul def
|
||||
/invsum invsum i -1 exp add def
|
||||
/i i 1 add def
|
||||
}repeat
|
||||
(Arithmetic Mean : ) print
|
||||
sum x div =
|
||||
(Geometric Mean : ) print
|
||||
prod x -1 exp exp =
|
||||
(Harmonic Mean : ) print
|
||||
x invsum div =
|
||||
}def
|
||||
|
||||
10 pythamean
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
/numbers {[1 10] 1 range}.
|
||||
/recip {1 exch div}.
|
||||
|
||||
% Arithmetic mean
|
||||
numbers dup 0 {+} fold exch length div
|
||||
% Geometric mean
|
||||
numbers dup 1 {*} fold exch length recip exp
|
||||
% Harmonic mean
|
||||
numbers dup 0 {recip +} fold exch length exch div
|
||||
Loading…
Add table
Add a link
Reference in a new issue