GeometricMean[data]
gives the geometric mean of the values in data.
GeometricMean
GeometricMean[data]
gives the geometric mean of the values in data.
Details
- For VectorQ data {x1,x2,…,xn}, the geometric mean is given by
. - GeometricMean[{{x1,y1,…},{x2,y2,…},…}] gives {GeometricMean[{x1,x2,…}],GeometricMean[{y1,y2,…}]}. »
- For ArrayQ data, the geometric mean estimate is equivalent to ArrayReduce[GeometricMean,data,1]. »
- GeometricMean handles both numerical and symbolic data.
- The data can have the following additional forms and interpretations:
-
Association the values (the keys are ignored) » SparseArray as an array, equivalent to Normal[data] » QuantityArray quantities as an array » WeightedData weighted mean, based on the underlying EmpiricalDistribution » EventData based on the underlying SurvivalDistribution » TimeSeries, TemporalData, … vector or array of values (the time stamps ignored) » Image,Image3D RGB channel's values or grayscale intensity value » Audio amplitude values of all channels »
Examples
open all close allBasic Examples (2)
Scope (13)
Basic Uses (6)
Exact input yields exact output:
GeometricMean[{1, 2, 3, 4}]GeometricMean[{π, E, 2}]Approximate input yields approximate output:
GeometricMean[{1., 2., 3., 4.}]GeometricMean[N[{1, 2, 3, 4}, 30]]Find the geometric mean of WeightedData:
GeometricMean[WeightedData[{1, 2, 3}, {Subscript[w, 1], Subscript[w, 2], Subscript[w, 3]}]]data = {8, 3, 5, 4, 9, 1, 4, 2, 2, 3};
weights = {0.15, 0.09, 0.12, 0.10, 0.16, 0.3, 0.11, 0.08, 0.08, 0.09};GeometricMean[WeightedData[data, weights]]Find the geometric mean of EventData:
e = {1.0, 2.1, 3.2, 4.5, 5.7};
ci = {0, 0, 0, 1, 0};GeometricMean[EventData[e, ci]]Find the geometric mean of a TimeSeries:
v = {3, 8, 4, 11, 9, 2};
t = {1, 3, 5, 7, 8, 10};
ts = TimeSeries[v, {t}];GeometricMean[ts]The geometric mean depends only on the values:
Mean[ts["Values"]]//NCompute a weighted geometric mean:
Mean[WeightedData[ts]]//NFind the geometric mean of data involving quantities:
data = Quantity[RandomReal[1, 6], "Meters"]GeometricMean[data]Array Data (5)
GeometricMean for a matrix gives columnwise means:
GeometricMean[Array[Subscript[a, ##]&, {2, 2}]]Mean for a tensor works across the first index: »
GeometricMean[Array[Subscript[a, ##]&, {4, 3, 2}]]GeometricMean[RandomReal[1, 10 ^ 7]]GeometricMean[RandomReal[1, {10 ^ 6, 3}]]When the input is an Association, GeometricMean works on its values:
mat = RandomReal[1, {2, 2}];
assoc = AssociationThread[Range[2], mat]GeometricMean[assoc]SparseArray data can be used just like dense arrays:
GeometricMean[SparseArray[{{1} -> 1, {2} -> 7}]]GeometricMean[SparseArray[{{1, 1} -> 1, {2, 1} -> 2, {2, 2} -> 3}]]sp = SparseArray[{{i_, i_} :> i, {i_, j_} /; j == i + 1 :> j}, {100, 10}, 1]GeometricMean[sp]Find the geometric mean of a QuantityArray:
data = QuantityArray[RandomReal[1, 6], "Pounds"]GeometricMean[data]Image and Audio Data (2)
Channelwise geometric mean value of an RGB image:
GeometricMean[[image]]RGBColor[%]Geometric mean intensity value of a grayscale image:
GeometricMean[[image]]On audio objects, GeometricMean works channelwise:
a = ExampleData[{"Audio", "Bee"}]AudioMeasurements[a, "Channels"]GeometricMean[a]Applications (1)
Find the geometric mean for the heights of children in a class:
heights = Quantity[{134, 143, 131, 140, 145, 136, 131, 136, 143, 136, 133, 145, 147,
150, 150, 146, 137, 143, 132, 142, 145, 136, 144, 135, 141}, "Centimeters"];ListPlot[heights, Filling -> Axis, AxesLabel -> Automatic](gm = GeometricMean[heights])//NListPlot[{heights, {{0, gm}, {25, gm}}}, Joined -> {False, True}, Filling -> Axis, AxesLabel -> Automatic]Properties & Relations (3)
GeometricMean is logarithmically related to Mean for positive values:
Mean[Log[{a, b, c, d}]]Log[GeometricMean[{a, b, c, d}]]//PowerExpandGeometricMean is logarithmically related to HarmonicMean for positive values:
HarmonicMean[1 / Log[{a, b, c, d}]]1 / Log[GeometricMean[{a, b, c, d}]]//PowerExpandFor positive data, HarmonicMean[d]≤GeometricMean[d]≤Mean[d]:
data = RandomReal[1, 10];HarmonicMean[data] ≤ GeometricMean[data] ≤ Mean[data]Prove the inequality symbolically:
data = {a, b, c};Simplify[HarmonicMean[data] ≤ GeometricMean[data] ≤ Mean[data], Min[data] ≥ 0]Possible Issues (1)
GeometricMean may return complex values when data contains negative values:
SeedRandom[2];
data = RandomVariate[MixtureDistribution[{1, 13}, {NormalDistribution[], GammaDistribution[3, 10]}], 100];Min[data]GeometricMean[data]For different sample realizations, the geometric mean is real:
SeedRandom[4];
data = RandomVariate[MixtureDistribution[{1, 13}, {NormalDistribution[], GammaDistribution[3, 10]}], 100];GeometricMean[data]See Also
Mean HarmonicMean ArithmeticGeometricMean ContraharmonicMean
Function Repository: MatrixGeometricMean GeothmeticMeandian
Tech Notes
Related Guides
Text
Wolfram Research (2007), GeometricMean, Wolfram Language function, https://reference.wolfram.com/language/ref/GeometricMean.html (updated 2023).
CMS
Wolfram Language. 2007. "GeometricMean." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2023. https://reference.wolfram.com/language/ref/GeometricMean.html.
APA
Wolfram Language. (2007). GeometricMean. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/GeometricMean.html
BibTeX
@misc{reference.wolfram_2026_geometricmean, author="Wolfram Research", title="{GeometricMean}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/GeometricMean.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_geometricmean, organization={Wolfram Research}, title={GeometricMean}, year={2023}, url={https://reference.wolfram.com/language/ref/GeometricMean.html}, note=[Accessed: 13-June-2026]}