Skip to content

harmonicMean

Subhajit Sahu edited this page Aug 8, 2022 · 1 revision

Find the harmonic mean of numbers.

Similar: arithmeticMean, geometricMean, harmonicMean, quadriaticMean, cubicMean.


function harmonicMean(...xs)
// xs: a list of numbers

const xmath = require('extra-math');


xmath.harmonicMean(1, 2);
// → 1.3333333333333333  (4/3)

xmath.harmonicMean(1, 2, 3);
// → 1.6363636363636365  (18/11)

xmath.harmonicMean(1, 2, 3, 4);
// → 1.92  (48/25)


References

Clone this wiki locally