Question #75363

Write down only one application of Runge Kutta Method to solve some real world problem
1

Expert's answer

2018-04-02T10:41:08-0400

Answer on Question #75363 – Math – Quantitative Methods

Question

Write down only one application of Runge Kutta Method to solve some real world problem.

Solution

The rate of change of the temperature dT(t)/dtdT(t)/dt, is (by Newton's Law of Cooling) proportional to the difference between the temperature of the object T(t)T(t) and the ambient temperature TaTa. This means that:


dT(t)dt=r(T(t)Ta),rpositive constant characteristic of the system\frac{dT(t)}{dt} = -r(T(t) - Ta), \quad r - \text{positive constant characteristic of the system}


The analytical solution of this differential equation:


T(t)=Ta+CertT(t) = Ta + C \cdot e^{-rt}


Let for t=0t = 0, T(0)=90T(0) = 90 and r=0.1r = 0.1 and Ta=30Ta = 30 then:


dT(t)dt=0.1(T(t)30) with IVP: T(0)=90\frac{dT(t)}{dt} = -0.1(T(t) - 30) \text{ with IVP: } T(0) = 90


And exact solution:


T(t)=30+60e0.1tT(t) = 30 + 60 \cdot e^{-0.1 \cdot t}


The Runge-Kutta-Fehlberg method is single-step method. This method has a procedure to determine whether the correct step size hh is used. Each step requires the use of the following six values:


k1=hf(xk,yk)k_1 = h \cdot f(x_k, y_k)k2=hf(xk+14h,yk+14k1)k_2 = h \cdot f\left(x_k + \frac{1}{4}h, y_k + \frac{1}{4}k_1\right)k3=hf(xk+38h,yk+332k1+932k2)k_3 = h \cdot f\left(x_k + \frac{3}{8}h, y_k + \frac{3}{32}k_1 + \frac{9}{32}k_2\right)k4=hf(xk+1213h,yk+19322197k172002197k2+72962197k3)k_4 = h \cdot f\left(x_k + \frac{12}{13}h, y_k + \frac{1932}{2197}k_1 - \frac{7200}{2197}k_2 + \frac{7296}{2197}k_3\right)k5=hf(xk+h,yk+439216k18k2+3680513k38454104k4)k_5 = h \cdot f\left(x_k + h, y_k + \frac{439}{216}k_1 - 8k_2 + \frac{3680}{513}k_3 - \frac{845}{4104}k_4\right)k6=hf(xk+12h,yk827k1+2k235442565k3+18594104k41140k5)k_6 = h \cdot f\left(x_k + \frac{1}{2}h, y_k - \frac{8}{27}k_1 + 2k_2 - \frac{3544}{2565}k_3 + \frac{1859}{4104}k_4 - \frac{11}{40}k_5\right)


Then we calculate the approximation to the solution with the help of the method of the fourth order:


wk+1=yk+25216k1+14082565k3+21974101k415k5,Error=O(h4)w_{k+1} = y_k + \frac{25}{216}k_1 + \frac{1408}{2565}k_3 + \frac{2197}{4101}k_4 - \frac{1}{5}k_5, \quad Error = O(h^4)


And the approximation to the solution with the help of the method of the 5th order:


yk+1=yk+16135k1+665612825k3+2856156430k4950k5+255k6,Error=O(h5)y_{k+1} = y_k + \frac{16}{135}k_1 + \frac{6656}{12825}k_3 + \frac{28561}{56430}k_4 - \frac{9}{50}k_5 + \frac{2}{55}k_6, \quad Error = O(h^5)


At each step, two different approximations for the solution are made and compared. The optimal step size is (δh)(\delta \cdot h).


R=1hwk+1yk+1,δ=(ε2R)14εspecified accuracyR = \frac{1}{h} |w_{k+1} - y_{k+1}|, \quad \delta = \left(\frac{\varepsilon}{2R}\right)^{\frac{1}{4}} \varepsilon - specified\ accuracy


Problem solving and error analysis:



The classical fourth-order Runge-Kutta method for computations with a constant integration step requires the calculation of four coefficients:


k3=f(xk+12h,yk+12k2)k _ {3} = f \left(x _ {k} + \frac {1}{2} h, y _ {k} + \frac {1}{2} k _ {2}\right)k4=f(xk+h,yk+hk3)k _ {4} = f \left(x _ {k} + h, y _ {k} + h k _ {3}\right)


Then we calculate the approximation to the solution with the help of the method of the fourth order:


yk+1=yk+h6(k1+2k2+2k3+k4)y _ {k + 1} = y _ {k} + \frac {h}{6} \left(k _ {1} + 2 k _ {2} + 2 k _ {3} + k _ {4}\right)


Problem solving and error analysis:


Runge4(y0,step,D):={(x00y0y0hstep)fori0.100[xi+1xi+hk1D(xi,yi)k2D(xi+h2,yi+hk12)k3D(xi+h2,yi+hk22)k4D(xi+h,yi+hk3)yi+1yi+h(k1+2k2+2k3+k46)returnaugment(x,y)\begin{array}{r l} \mathrm {R u n g e 4 (y 0 , s t e p , D)} := & \left\{ \begin{array}{l l} \left(x _ {0} \leftarrow 0 y _ {0} \leftarrow y 0 h \leftarrow \mathrm {s t e p}\right) \\ \mathrm {f o r i \in 0 . 1 0 0} \\ \left[ \begin{array}{l} x _ {i + 1} \leftarrow x _ {i} + h \\ k 1 \leftarrow D \left(x _ {i}, y _ {i}\right) \\ k 2 \leftarrow D \left(x _ {i} + \frac {h}{2}, y _ {i} + \frac {h \cdot k 1}{2}\right) \\ k 3 \leftarrow D \left(x _ {i} + \frac {h}{2}, y _ {i} + \frac {h \cdot k 2}{2}\right) \\ k 4 \leftarrow D \left(x _ {i} + h, y _ {i} + h \cdot k 3\right) \\ y _ {i + 1} \leftarrow y _ {i} + h \left(\frac {k 1 + 2 \cdot k 2 + 2 \cdot k 3 + k 4}{6}\right) \\ \mathrm {r e t u r n a u g m e n t (x , y)} \end{array} \right. \end{array} \right. \end{array}


Error calculation.

T - exact value

AT - approximation


Z:=Runge4(y0,0.15,D)Z := \operatorname {R u n g e} 4 \left(y _ {0}, 0. 1 5, D\right)i:=0r o w s(Z)1t i m ei:=Zi,0Ti:=fT(t i m ei)ATi:=Zi,1TAT=0.0000008016i := 0 \dots \text {r o w s} (Z) - 1 \quad \text {t i m e} _ {i} := Z _ {i, 0} \quad T _ {i} := f T (\text {t i m e} _ {i}) \quad A T _ {i} := Z _ {i, 1} \quad | T - A T | = 0. 0 0 0 0 0 0 8 0 1 6


Answer provided by https://www.AssignmentExpert.com

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!
LATEST TUTORIALS
APPROVED BY CLIENTS