The Runge-Kutta-Fehlberg 4th-order method with 5th-order error checking (RKF45) is a numerical integration technique for ordinary differential equations (ODEs) that utilizes an adaptive step size to achieve a prescribed error tolerance, ϵ. It is used by each page in this website that solves an ODE system. In it, we assume our ODE system has the form
dtdx=f(x,t). To numerically integrate this system, we discretize our domain of t values. We will not know how many points we discretize our domain into until after we have finished the integration, due to our adaptive step size. At each step i, we will use the step size hi and we will utilize the integration scheme
k1,ik2,ik3,ik4,ik5,ik6,iX1,iX2,iRiSirisihi=hif(xi,ti)=hif(xi+4k1,i,ti+4hi)=hif(xi+323k1,i+329k2,i,ti+83hi)=hif(xi+21971932k1,i−21977200k2,i+21977296k3,i,ti+1312hi)=hif(xi+216439k1,i−8k2,i+5133680k3,i−4104845k4,i,ti+hi)=hif(xi−278k1,i+2k2,i−25653544k3,i+41041859k4,i−4011k4,i,ti+2hi)=xi+21625k1,i+25651408k3,i+41042197k4,i−5k5,i=xi+13516k1,i+128256656k3,i+5643028561k4,i−509k5,i+552k6,i=hi∣X1,i−X2,i∣=[2Riϵ]1/4=maxRi=minSi=sihi. If ri≤ϵ, we let X1,i be our value of xi+1, hi+1 be hi, increment i by 1, and proceed to the next step. Otherwise, we repeat the calculation with our updated step size. In the Ri calculation, ∣v∣ denotes a vector whose elements are the absolute value of the elements of v, not its vector magnitude. Here ri is the maximum error estimate we have for step i.
hi can become unmanageably small if the problem one is solving is too numerically unstable. This can be seen in the double elastic pendulum solver webpage if you reduce ϵ to too small a value or increase tf too much.