I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
get GPL
COST (GBP)
this unit 0.40
sub units 0.00
+
0

Geometric

Calculates the geometric mean of a given population.
Controller: CodeCogs

Interface

C++

Geometric

 
template<class T> doublegeometricintn
T*data )
The geometric mean of a sequence \inline x_i is defined by:

Thus,

and so on. For \inline N=2, the geometric mean is related to the arithmetic mean and harmonic mean by where:
  • A = arithmetic mean and
  • H = harmonic mean]

Example 1

#include <codecogs/statistics/moments/geometric.h>
#include <iostream>
#include<math.h>
int main() 
{
  int x[5] = {4 , 6 , 1 , 3 , 7};
  double geom = Stats::Moments::geometric(5, x);
  std::cout << "The population mean is: " << geom << std::endl;
  return 0;
}
Output:
The population mean is: 3.47125

Parameters

nthe size of the population
datathe actual population data given as an array

Returns

return value the geometric mean of the given population

Authors

Anca Filibiu (August 2005)
Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.