//Code segment example for adaptive step size //Assume non-interleaved RK-integration wrt x. //Assume we know dx. //eps0 is the desired error. //within x-loop... ytemp1=y1; ytemp2=y1; RKintegrate(x1,ytemp1,dx); //returns ytemp1 RKintegrate(x1,ytemp1,dx); //returns ytemp1 again RKintegrate(x1,ytemp2,2.0*dx);//returns ytemp2 epsilon=fabs(ytemp2-ytemp2); dx=dx*pow(eps0/epsilon,0.20); RKintegrate(x1,y1,dx); //now, find y1 and continue