PDF4PRO ⚡AMP

Modern search engine that looking for books and documents around the web

Example: quiz answers

Runge-Kutta method

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 solutiony(ti)Numerical solutionwiError|wi y(ti)| this can be done by using Matlab:function rungekuttah = ;t = 0;w = ;fprintf( Step 0: t = % , w = % \n , t, w);for i=1:4k1 = h*f(t,w);k2 = h*f(t)}}

Here’s the formula for the Runge-Kutta-Fehlberg method (RK45). w 0 = k 1 = hf(t i;w i) k 2 = hf t i + h 4;w i + k 1 4 k 3 = hf t i + 3h 8;w i + 3 32 k 1 + 9 32 k 2 k 4 = hf t i + 12h 13;w i + 1932 2197 k 1 7200 2197 k 2 + 7296 2197

Tags:

  Methods, Runge, Kutta, Runge kutta methods

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Spam in document Broken preview Other abuse

Transcription of Runge-Kutta method

Related search queries