Skip to content

geometricMean

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

Find the geometric mean of numbers.

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


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

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


xmath.geometricMean(1, 2);
// → 1.4142135623730951  (Math.sqrt(2))

xmath.geometricMean(1, 2, 3);
// → 1.8171205928321397  (Math.cbrt(6))

xmath.geometricMean(1, 2, 3, 4);
// → 2.2133638394006434  (Math.pow(24, 1/4))


References

Clone this wiki locally