harmonic-mean ( seq -- x )
Statistics

Prev:geometric-mean ( seq -- x )
Next:median ( seq -- x )


Vocabulary
math.statistics

Inputs
seqa sequence


Outputs
xa non-negative real number


Word description
Computes the harmonic mean of the elements in seq. The harmonic mean is appropriate when the average of rates is desired.

Notes
Positive reals only.

Examples
USING: math.statistics prettyprint ; { 1 2 3 } harmonic-mean .
1+7/11


Errors
Throws a signal-error. (divide by zero) if the sequence is empty.

Definition