Skip to main content
Module

x/simplestatistics/index.js>harmonicMean

simple statistics for node & browser javascript
Go to Latest
function harmonicMean
import { harmonicMean } from "https://deno.land/x/simplestatistics@v7.7.5/index.js";

The Harmonic Mean is a mean function typically used to find the average of rates. This mean is calculated by taking the reciprocal of the arithmetic mean of the reciprocals of the input numbers.

This is a measure of central tendency: a method of finding a typical or central value of a set of numbers.

This runs in O(n), linear time, with respect to the length of the array.

Examples

harmonicMean([2, 3]).toFixed(2) // => '2.40'

Parameters

x

sample of one or more data points