Tool to compute a geometric mean: an estimate of the tendency of the data in a list, it has the advantage of being less sensitive to high values.

Geometric Mean - dCode

Tag(s) : Statistics, Data Processing

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!

A suggestion ? a feedback ? a bug ? an idea ? *Write to dCode*!

For a list of $ n $ values $ X = \{x_1, x_2, \dots, x_n\} $, the geometric mean is defined by the nth root ( $ \sqrt[n]{\dots} $ ) of the product of the values.

$$ \bar{x}_{geom} = \sqrt[n]{\prod_{i=1}^n{x_i}} $$

From a list of $ n $ values whose product (the multiplication of all the values) is $ p $, calculate the nth root of $ p $ that is $ \sqrt[n]{p} $.

__Example:__ The list of $ 3 $ numbers $ \{ 1, 10, 100 \} $ has for geometric mean $ \sqrt[3]{1 \times 10 \times 100} = 10 $, whereas it has for arithmetic mean $ 55.5 $.

To get a *geometric* representation, the geometric mean of the sides of a rectangle has a value $ c $ which could be the length of one side of a square of area identical to the original rectangle.

__Example:__ A rectangle of $ 6 \times 10 $ has an area of $ 60 $. The geometric mean of $ 6 $ and $ 10 $ is $ \approx 7.746 $. And a square of side length $ 7.746 $ has an area of $ \approx 60 $.

When the values are assigned coefficients, it is called a weighted geometric mean.

Using the mathematical formula: `//Python`

or to avoid a potential number overflow:

import numpy as np

def geometric_mean(iterable):

a = np.array(iterable)

return a.prod()**(1.0/len(a))`//Python`

import numpy as np

def geometric_mean(iterable):

a = np.log(iterable)

return np.exp(a.sum()/len(a))

dCode retains ownership of the "Geometric Mean" source code. Except explicit open source licence (indicated Creative Commons / free), the "Geometric Mean" algorithm, the applet or snippet (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or the "Geometric Mean" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) and all data download, script, or API access for "Geometric Mean" are not public, same for offline use on PC, mobile, tablet, iPhone or Android app!

Reminder : dCode is free to use.

The copy-paste of the page "Geometric Mean" or any of its results, is allowed (even for commercial purposes) as long as you credit dCode!

Exporting results as a .csv or .txt file is free by clicking on the *export* icon

Cite as source (bibliography):

*Geometric Mean* on dCode.fr [online website], retrieved on 2024-09-09,

mean,number,geometric,list

https://www.dcode.fr/geometric-mean

© 2024 dCode — El 'kit de herramientas' definitivo para resolver todos los juegos/acertijos/geocaching/CTF.

Feedback