Harmonic mean.
Example 1
Calculate the harmonic mean for given values. Uses MtxExpr, Statistics, Math387;
procedure Example;
var a: Vector;
MH : TSample;
begin
a.SetIt(false,[2,3,5,4]);
MH := MeanH(a); // MH = 3.11688311688312
end;
#include "MtxVecCpp.h"
#include "Statistics.hpp"
void __fastcall Example();
{
Vector a;
a->SetIt(false, OPENARRAY(double,(2,3,5,4)));
double MH = MeanH(a);
// MH = 3.11688311688312
}
using Dew.Math;
using Dew.Stats;
using Dew.Stats.Units;
namespace Dew.Examples
{
private void Example()
{
Vector a = new Vector(0),
a.SetIt(false, new double[] {2,3,5,4});
double MH = Statistics.MeanH(a);
// MH = 3.11688311688312
}
}