add numerical recipes library

This commit is contained in:
2025-09-12 18:55:25 +09:00
parent d4dff245bd
commit 2c75620ec9
1344 changed files with 63869 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
/* Driver for routine beschb */
#include <stdio.h>
#include <math.h>
#define NRANSI
#include "nr.h"
#include "nrutil.h"
int main(void)
{
double gam1,gam2,gampl,gammi,x,xgam1,xgam2,xgampl,xgammi;
for (;;) {
printf("Enter x:\n");
if (scanf("%lf",&x) == EOF) break;
beschb(x,&xgam1,&xgam2,&xgampl,&xgammi);
printf("%5s\n%17s %16s %17s %15s\n%17s %16s %17s %15s\n",
"x","gam1","gam2","gampl","gammi","xgam1","xgam2","xgampl","xgammi");
gampl=1/exp(gammln((float)(1+x)));
gammi=1/exp(gammln((float)(1-x)));
gam1=(gammi-gampl)/(2*x);
gam2=(gammi+gampl)/2;
printf("%5.2f\n\t%16.6e %16.6e %16.6e %16.6e\n",x,gam1,gam2,gampl,gammi);
printf("\t%16.6e %16.6e %16.6e %16.6e\n",xgam1,xgam2,xgampl,xgammi);
}
return 0;
}
#undef NRANSI