Transcription of Runge-Kutta method
{{id}} {{{paragraph}}}
Runge-Kutta methodThe formula for the fourth order Runge-Kutta method (RK4) is given below. Consider theproblem{y =f(t,y)y(t0) = Definehto be the time step size andti=t0+ih. Then the following formulaw0= k1=hf(ti, wi)k2=hf(ti+h2, wi+k12)k3=hf(ti+h2, wi+k22)k4=hf(ti+h, wi+k3)wi+1=wi+16(k1+ 2k2+ 2k3+k4)computes an approximate solution, that iswi y(ti).Let us look at an example:{y =y t2+ 1y(0) = exact solution for this problem isy=t2+ 2t+ 1 12et, and we are interested in the value ofyfor0 t We first solve this problem using RK4 withh= 0tot= 2with step sizeh= , it takes 4 steps:t0= 0,t1= ,t2= 1,t3= ,t4= 0t0= 0,w0= 1t1= (t0,w0) = (0, ) = (t0+h/2,w0+k1/2) = ( , ) = (t0+h/2,w0+k2/2) = ( , ) = (t0+h,w0+K3) = ( , ) = + (k1+ 2k2+ 2k3+k4)/6 = 2t2= 1k1=hf(t1,w1) = ( , ) = (t1+h/2,w1+k1/2) = ( , ) = (t1+h/2,w1+k2/2) = ( , ) = (t1+h,w1+K3) = (1, ) = + (k1+ 2k2+ 2k3+k4)/6 = 3t3= (t2,w2) = (1, ) = (t2+h/2,w2+k1/2) = ( , ) = (t2+h/2,w2+k2/2) = ( , ) = (t2+h,w2+K3) = ( , ) = + (k1+ 2k2+ 2k3+k4)/6 = 4t4= 2k1=hf(t3,w3) = ( , ) = (t3+h/2,w3+k1/2) = ( , ) = (t3+h/2,w3+k2/2) = ( , ) = (t3+h,w3+K3) = (2, ) = + (k1+ 2k2+ 2k3+k4)/6 = let s compare what we got with the exact solutiontiExact solutio}}
3680 513 k 3 845 4104 k 4 k 6 = hf t i + h 2;w i 8 27 k 1 +2k 2 3544 2565 k 3 + 1859 4104 k 4 11 40 k 5 w i+1 = w i + 25 216 k 1 + 1408 2565 k 3 + 2197 4104 k 4 1 5 k 5 w~ i+1 = w i + 16 135 k 1 + 6656 12825 k 3 + 28561 56430 k 4 9 50 k 5 + 2 55 k 6 R= 1 h jw~ i+1 w i+1j = 0:84 " R 1=4 if R " keep was the current step solution and move to the ...
Domain:
Source:
Link to this page:
Please notify us if you found a problem with this document:
{{id}} {{{paragraph}}}