Gamma Simple
A Sterling series approximation of the gamma function.
Controller: CodeCogs
| doublegamma_simple( | double | x | )[inline] |
Returns a simple approximation to the gamma functions. If your only interested in low levels of accuracy
(10 significant figures), then this solution is evaluated quickly and is relatively stable.
This approximation of the gamma function is achieved using the exponential of the Stirling series,
where
See also Maths/Special/Gamma/Gamma and Maths/Special/Gamma/Stirling
Example 1
#include <codecogs/maths/special/gamma/gamma_simple.h> #include <stdio.h> int main() { for(double x=3; x<7; x+=0.4) printf("\n x=%lf gamma_simple=%lf",x, Maths::Special::Gamma::gamma_simple(x)); return 0; }
Output:x=3.000000 gamma_simple=2.000000 x=3.400000 gamma_simple=2.981206 x=3.800000 gamma_simple=4.694174 x=4.200000 gamma_simple=7.756690 x=4.600000 gamma_simple=13.381286 x=5.000000 gamma_simple=24.000000 x=5.400000 gamma_simple=44.598848 x=5.800000 gamma_simple=85.621738 x=6.200000 gamma_simple=169.406099 x=6.600000 gamma_simple=344.701924
Parameters
x argument
Authors
- Tony Ottosson and Pal Frenger
Documention by Will Bateman (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.



1.40
