Handbook
Glossary
geometric-mean ( seq -- x )
Statistics
Prev:
mean ( seq -- x )
Next:
harmonic-mean ( seq -- x )
Vocabulary
math
.
statistics
Inputs
seq
a
sequence
Outputs
x
a non-negative real number
Word description
Computes the geometric mean of all elements in
seq
. The geometric mean measures the central tendency of a data set and minimizes the effects of extreme values.
Examples
USING: math.statistics prettyprint ; { 1 2 3 } geometric-mean .
1.8171205928321397
Errors
Throws a
signal-error.
(square-root of 0) if the sequence is empty.
Definition
USING:
kernel
math
math.functions
sequences
;
IN:
math.statistics
:
geometric-mean
( seq -- x )
[
[
log
]
map-sum
]
[
length
]
bi
/f
e^
;
inline