HomeMath › Mean Calculator (Arithmetic, Geometric, Harmonic, Quadratic)

Mean Calculator (Arithmetic, Geometric, Harmonic, Quadratic)

Computes the Pythagorean means (arithmetic, geometric, harmonic) of a list of numbers together with the quadratic mean (root mean square), the contraharmonic mean, the midrange and the median.

When to use

You need a specific kind of average, e.g. the geometric mean of growth factors, the harmonic mean of rates or speeds, or the RMS of signal values, or want to compare the different means of one data set.

Do not use when: You need dispersion measures such as variance and standard deviation (use descriptive-statistics) or a weighted average (use weighted-average).

Formula

A = Σx/n; G = (Πx)^(1/n); H = n/Σ(1/x); Q = √(Σx²/n); C = Σx²/Σx; midrange = (min + max)/2

Inputs

ParameterTypeUnitRequiredDescription
numbersnumber_listyesThe values, comma-separated. Geometric and harmonic means require all values to be positive.

Outputs

OutputTypeUnitDescription
arithmetic_meannumberΣx / n.
geometric_meannumber(Πx)^(1/n), computed as exp(mean(ln x)); only for positive values.
harmonic_meannumbern / Σ(1/x); only for positive values.
quadratic_meannumber√(Σx² / n), the root mean square.
contraharmonic_meannumberΣx² / Σx (requires Σx ≠ 0).
midrangenumber(min + max) / 2.
mediannumberMiddle value of the sorted list (mean of the two middle values for an even count).
countintegerNumber of values n.
inequalitystringFor positive values: harmonic ≤ geometric ≤ arithmetic ≤ quadratic ≤ contraharmonic, with equality only when all values are equal.

Example

1, 2, 4, 8: {"numbers":[1,2,4,8]}{"arithmetic_mean":3.75,"geometric_mean":2.828427,"harmonic_mean":2.133333,"quadratic_mean":4.609772,"contraharmonic_mean":5.666667,"midrange":4.5,"median":3,"count":4}

4 and 9: {"numbers":[4,9]}{"arithmetic_mean":6.5,"geometric_mean":6,"harmonic_mean":5.538462,"quadratic_mean":6.964194,"contraharmonic_mean":7.461538,"midrange":6.5,"median":6.5,"count":2}

GET https://tttkmbb.com/api/v1/calculate/mean-types?numbers=1%2C2%2C4%2C8

Machine access

Sources

FAQ

When should I use the geometric or harmonic mean?

Geometric for quantities that multiply (growth rates, ratios, index numbers); harmonic for rates over a fixed quantity (average speed over equal distances, price/earnings ratios). The arithmetic mean overstates both.

Why is the geometric mean missing?

It is only defined for positive values (a zero makes it 0 and negatives make it complex), so it and the harmonic mean are omitted, with a note, when the list contains zero or negative numbers.

Related calculators