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 3.12
sub units 0.00
+
0
MathsSpecialGamma

Log Gamma

viewed 2699 times and licensed 198 times
Calculates the natural logarithm of the Gamma function with argument \e x.
Controller: CodeCogs

Dependents

Info

Interface

C++
Excel

Log Gamma

 
doublelog_gammadoublex )
This algorithm uses rational functions that approximate \inline  \log \Gamma(x) to at least 18 significant decimal digits. The accuracy achieved also depends on the arithmetic system and the compiler.

Example:

#include <codecogs/maths/special/gamma/log_gamma.h>
#include <iostream>
#include <iomanip>
int main()
{
  for (double x = 0; x <= 10; x += 0.5)
  {
    std::cout << "log Gamma(" << x << ") = " << std::setprecision(20);
    std::cout << Maths::Special::Gamma::log_gamma(x) << std::endl;
  }
  return 0;
}

Output:

log Gamma(0) = 1.#INF
log Gamma(0.5) = 0.57236494292469997
log Gamma(1) = 0
log Gamma(1.5) = -0.12078223763524526
log Gamma(2) = 0
log Gamma(2.5) = 0.28468287047291918
log Gamma(3) = 0.6931471805599454
log Gamma(3.5) = 1.2009736023470743
log Gamma(4) = 1.7917594692280552
log Gamma(4.5) = 2.4537365708424423
log Gamma(5) = 3.1780538303479453
log Gamma(5.5) = 3.9578139676187161
log Gamma(6) = 4.7874917427820449
log Gamma(6.5) = 5.6625620598571409
log Gamma(7) = 6.5792512120101012
log Gamma(7.5) = 7.5343642367587336
log Gamma(8) = 8.5251613610654129
log Gamma(8.5) = 9.5492672573009987
log Gamma(9) = 10.604602902745247
log Gamma(9.5) = 11.689333420797267
log Gamma(10) = 12.801827480081469

References:

SUBSET, a C++ library of combinatorial routines, http://www.csit.fsu.edu/~burkardt/cpp_src/subset/subset.html

Parameters

xthe desired argument

Returns

the natural logarithm of \inline  \Gamma(x)

Authors

Lucian Bentea (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.