Stirling
Stirling series approximation of the gamma function
Controller: CodeCogs
Contents
Dependents
Interface
C++
Stirling
doublestirling( | double | x | ) |
There is an error with your graph parameters for stirling with options x=1:5 .log
Error Message:Function stirling failed. Ensure that: Invalid C++
See Also:
Maths/Special/Gamma/Gamma and Maths/Special/Gamma/Gamma_SimpleAccuracy:
In comparison to integer fractorial, this approximate it accurate to about 15dp at x=35, but obviously very poor for lower values of x (i.e. x<6)Example 1
- Compared the outut from Stirling with a traditional factorial
#include <codecogs/maths/special/gamma/stirling.h> #include <stdio.h> int main () { for(double x=33; x<=40; x+=0.5) printf("\n x=%lf stirling(x)=%.0lf",x, Maths::Special::Gamma::stirling(x)); }
Output:
x=33.000000 stirling(x)=263130836933693517766352317727113216 x=33.500000 stirling(x)=1505856975626702287543640208112091136 x=34.000000 stirling(x)=8683317618811887119307294612729626624 x=34.500000 stirling(x)=50446208683494518220996649360199516160 x=35.000000 stirling(x)=295232799039604195113013396920323801088 x=35.500000 stirling(x)=1740394199580561001405912957537658863616 x=36.000000 stirling(x)=10333147966386146640060809577425524490240 x=36.500000 stirling(x)=61783994085109902705073076587151908405248 x=37.000000 stirling(x)=371993326789901177492420297158468206329856 x=37.500000 stirling(x)=2255115784106511937141198419741231238086656 x=38.000000 stirling(x)=13763753091226345578872114833606270345281536 x=38.500000 stirling(x)=84566841903994165920581434052426627138191360 x=39.000000 stirling(x)=523022617466601117141859892252474974331207680 x=39.500000 stirling(x)=3255823413303776398101457267888729462505734144 x=40.000000 stirling(x)=20397882081197441587828472941238084160318341120
References:
Cephes Math Library Release 2.8: June, 2000 http://mathworld.wolfram.com/StirlingsSeries.htmlParameters
x a value.
Returns
- an approximation of the factorial of x.
Authors
- Stephen L.Moshier. Copyright 1984, 1987, 1989, 1992, 2000
Documentation 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.