Skip to main content

Harmonic Mean Calculator

This harmonic mean calculator averages positive values or rates through their reciprocals. Add relative weights when numerator amounts, such as travel distances, differ.

Average positive values through their reciprocals

A harmonic mean averages positive observations through their reciprocals. Add the reciprocals, divide the observation count by that sum, and retain the common input unit. Smaller values have greater influence than they do in an arithmetic average. This is useful for rates when the numerator amounts are equal. For speeds, the numerator amount is distance. Equal-distance legs use a harmonic average of their speeds; equal-time legs use an arithmetic average. The tool does not infer which condition your trip satisfies. Paste positive values for equal weighting. If numerator amounts differ, enter one value and relative weight pair per line. Weights represent those numerator amounts, such as distances, rather than the times spent at each speed. Use a common unit for every value and a common weight unit. No automatic unit conversion is applied.

Check the averaging basis

For speeds, equal distances use the harmonic mean and equal times use the arithmetic mean.

Keep inputs positive

Zero and negative observations are rejected, including values with zero weight. This calculator uses a positive reciprocal domain.

Use numerator weights

Known relative distances can weight speeds. Scaling every weight equally preserves the result.

Check an equal-distance average

The equal-distance preset uses speeds 40 and 60, sharing one common speed unit. Their reciprocal sum is approximately 0.04166666667. Dividing observation count 2 by that sum gives harmonic mean 48. The arithmetic comparison is 50.

The official Python statistics documentation uses these speeds to explain equal-distance averaging. Total distance divided by total time gives the harmonic result. If the time spent at each speed were equal instead, the arithmetic comparison would be the relevant average speed.

The ordinary-values preset 1 4 4 has reciprocal sum 1.5, harmonic mean 2 and arithmetic mean 3. The official SciPy harmonic-mean documentation states the reciprocal identity. These are different averages of the same values, rather than competing estimates of an unspecified quantity.

Choose the right weights for rates

In weighted mode, each pair contains a positive value and a nonnegative relative numerator amount. The unequal-distance preset assigns weights 5 and 30 to speeds 40 and 60. Total weight is 35. The weighted reciprocal sum is approximately 0.625, giving harmonic mean 56. The arithmetic comparison using the same relative weights is approximately 57.14285714.

Python documents these unequal-distance weights and speeds. Each distance divided by its speed contributes travel time. Divide total distance by total time to obtain average speed. Relative weights are sufficient; their total does not have to match a percentage total. SciPy gives the general weighted reciprocal formula.

A zero weight omits a row from aggregation after all values and weights are validated. The check with value-weight pairs 1,0; 8,3 has 1 included row and harmonic mean 8. At least one weight must be positive. Negative weights and nonpositive values are unsupported.

The arithmetic comparison normalizes the same weights, as described by R’s weighted.mean documentation. For unequal-distance speeds, this distance-weighted arithmetic comparison is an audit comparison, not the total-distance/total-time average. Time weights would be a different basis. Do not supply time weights and treat the harmonic answer as an average speed.

Handle positive inputs and numerical limits

This calculator requires positive values because its stated model sums reciprocals of positive observations. Some software, including Python statistics, extends the result to zero when a value is zero. That limit convention is outside this tool’s positive domain. The engine neither skips a zero nor silently returns a different extension. Negative values, signed means and mixed-unit rates are also outside its scope.

The input check 1e-100 1e100 has harmonic mean approximately 2e-100 and arithmetic mean approximately 5e+99. The calculation normalizes weights and scales reciprocals by the smallest included value. The equivalent scaled identity gives a finite mean across the supported magnitude range. It does not round the reciprocal terms before summing them.

For additive averaging, use the Mean Median Mode Calculator or Weighted Average Calculator. For multiplicative factors, use the Geometric Mean Calculator. Choosing the right mean depends on the relationship your values represent, rather than which result looks preferable.

Local limits are 5,000 observations or weighted rows, 100,000 characters, and 128 characters per numeric token. Nonzero magnitudes range from 1e-100 to 1e+100. Details show the first 100 rows; every validated positive-weight row contributes. Simple fractions, decimals and scientific notation are accepted. Results display up to 10 significant digits after calculation; precision lost before values are entered cannot be recovered. No financial valuation, uncertainty estimate or automatic travel-unit conversion is inferred.

References

(4)