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,25 @@
#include <math.h>
#define JMAX 20
float rtnewt(funcd,x1,x2,xacc)
float x1,x2,xacc;
void (*funcd)();
{
void nrerror();
int j;
float df,dx,f,rtn;
rtn=0.5*(x1+x2);
for (j=1;j<=JMAX;j++) {
(*funcd)(rtn,&f,&df);
dx=f/df;
rtn -= dx;
if ((x1-rtn)*(rtn-x2) < 0.0)
nrerror("Jumped out of brackets in rtnewt");
if (fabs(dx) < xacc) return rtn;
}
nrerror("Maximum number of iterations exceeded in rtnewt");
return 0.0;
}
#undef JMAX