Harmonic Mean

Author

Eric W. Weisstein
January 19, 2005

This notebook downloaded from http://mathworld.wolfram.com/notebooks/SpecialFunctions/HarmonicMean.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/HarmonicMean.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Initialization

<<Statistics`DescriptiveStatistics`

Code

MyHarmonicMean[l_List]:=Length[l]/Plus@@(1/l)

Examples

Table[HarmonicMean[Array[x,n]]-MyHarmonicMean[Array[x,n]],{n,10}]

Together[HarmonicMean[{(Subscript[x, 1]),(Subscript[x, 2])}]]

Together[HarmonicMean[{(Subscript[x, 1]),(Subscript[x, 2]),(Subscript[x, 3])}]]

Integers 1, …, n

HarmonicMean/@Reverse[NestList[Most,Range[10],9]]

InputForm[%38]

Through[{Numerator,Denominator}[%]]

Relationship to A and G

With[{n=2},Eliminate[Thread[{G,H,A}==Through[{GeometricMean,HarmonicMean,Mean}[Array[x,n]]]^n],Array[x,n]]
]

Solve[G^2==A H,H]

With[{n=3},Eliminate[Thread[{g,h,a}==Through[{GeometricMean,HarmonicMean,Mean}[Array[x,n]]]^n],Array[x,n]]
]//Timing

x=Array[a,3];

GeometricMean[x]^3

Mean[x]

Together[HarmonicMean[x]]

GroebnerBasis[
{
G^3-x1 x2 x3,
3A-(x1+x2+x3),
H(x1 x2+x1 x3+x2 x3)-3 x1 x2 x3
},
{G,A,H},
{x1,x2,x3},
MonomialOrder->EliminationOrder]//Timing

Eliminate[
{
G^3-x1 x2 x3==0,
3A-(x1+x2+x3)==0,
H(x1 x2+x1 x3+x2 x3)-3 x1 x2 x3==0
},
{x1,x2,x3}]//Timing