⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gser.c

📁 适合大型数值计算代码 现在网络上已经找不到了 购买需要20$
💻 C
字号:
#include <math.h>#define ITMAX 100#define EPS 3.0e-7void gser(float *gamser, float a, float x, float *gln){	float gammln(float xx);	void nrerror(char error_text[]);	int n;	float sum,del,ap;	*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;			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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -