Category : C Source Code
Archive   : RECIPEX.ZIP
Filename : GSER.C

 
Output of file : GSER.C contained in archive : RECIPEX.ZIP
#include

#define ITMAX 100
#define EPS 3.0e-7

void gser(gamser,a,x,gln)
float a,x,*gamser,*gln;
{
int n;
float sum,del,ap;
float gammln();
void nrerror();

*gln=gammln(a);
if (x <= 0.0) {
if (x < 0.0) nrerror("x less than 0 in routine GSER");
*gamser=0.0;
return;
} else {
ap=a;
del=sum=1.0/a;
for (n=1;n<=ITMAX;n++) {
ap += 1.0;
del *= x/ap;
sum += del;
if (fabs(del) < fabs(sum)*EPS) {
*gamser=sum*exp(-x+a*log(x)-(*gln));
return;
}
}
nrerror("a too large, ITMAX too small in routine GSER");
return;
}
}

#undef ITMAX
#undef EPS


  3 Responses to “Category : C Source Code
Archive   : RECIPEX.ZIP
Filename : GSER.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/