#include #include //============================================================== void nrerror(char * error_text) { cerr<<"Numerical Recipes run-time error : "< ERRCON ? SAFETY*h*exp(PGROW*log(errmax)) : 4.0*h); break; } h=SAFETY*h*exp(PSHRNK*log(errmax)); } for (i=0;i x1) ? fabs(h1) : -fabs(h1); *nok = (*nbad) = kount = 0; for (i=0;i 0) xsav=x-dxsav*2.0; for (nstp=1;nstp<=MAXSTP;nstp++) { (*derivs)(x,y,dydx); for (i=0;i 0) { if (fabs(x-xsav) > fabs(dxsav)) { if (kount < kmax-1) { xp[++kount]=x; for (i=0;i 0.0) h=x2-x; rkqc(y,dydx,nvar,&x,h,eps,yscal,&hdid,&hnext,derivs); if (hdid == h) ++(*nok); else ++(*nbad); if ((x-x2)*(x2-x1) >= 0.0) { for (i=0;i