Question #76730

Q. Write and solve an example of Runge Kutta Fehlberg Method.
1

Expert's answer

2018-05-01T08:23:08-0400

Answer on Question #76730 – Math – Quantitative Methods

Question

Write and solve an example of Runge Kutta Fehlberg Method.

Solution

The rate of change of the temperature dT(t)dt\frac{dT(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 TaT_a. This means that:


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


The analytical solution of this differential equation:


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


Let for t=0t = 0, T(0)=5T(0) = 5 and r=0.3r = 0.3 and Ta=35T_a = 35 then:


dT(t)dt=0.3(T(t)35) with IVP: T(0)=5\frac{dT(t)}{dt} = -0.3(T(t) - 35) \text{ with IVP: } T(0) = 5


And exact solution:


T(t)=3530e0.3tT(t) = 35 - 30 \cdot e^{-0.3 \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:


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


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


yk+15=yk+16135k1+665612825k3+2856156430k4950k5+255k6,Error=O(h5)y_{k+1}^{5} = 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).


εn+1=1hyk+14yk+15,δ=0.84(εεn+1)14,εspecified accuracy\varepsilon_{n+1} = \frac{1}{h} \left| y_{k+1}^{4} - y_{k+1}^{5} \right|, \quad \delta = 0.84 \left( \frac{\varepsilon}{\varepsilon_{n+1}} \right)^{\frac{1}{4}}, \quad \varepsilon - specified\ accuracy


Problem solving and error analysis:

D(t,T) := -0.3·(T - 35) y0:=5y_0 := 5

D(t,T) - 1st order ODE with IVP


\text {R u n g e} 4 5 (\mathrm {y} 0, \mathrm {D}) := \left\{ \begin{array}{l} \left(z _ {0} \leftarrow 0 \quad y _ {0} \leftarrow y 0 \quad h \leftarrow 1 0 ^ {- 2}\right) \\ \text {f o r} \quad i \in 0.. 3 0 \\ \left| z _ {i + 1} \leftarrow z _ {i} + h \\ k 1 \leftarrow D \left(z _ {i}, y _ {i}\right) \\ k 2 \leftarrow D \left(z _ {i} + \frac {h}{4}, y _ {i} + \frac {h \cdot k 1}{4}\right) \\ k 3 \leftarrow D \left(z _ {i} + \frac {3 \cdot h}{8}, y _ {i} + \frac {h \cdot 3 \cdot k 1}{3 2} + \frac {h \cdot 9 \cdot k 2}{3 2}\right) \\ k 4 \leftarrow D \left(z _ {i} + \frac {1 2 \cdot h}{1 3}, y _ {i} + \frac {h \cdot 1 9 3 2 \cdot k 1}{2 1 9 7} - \frac {h \cdot 7 2 0 0 \cdot k 2}{2 1 9 7} + \frac {h \cdot 7 2 9 6 \cdot k 3}{2 1 9 7}\right) \\ k 5 \leftarrow D \left(z _ {i} + h, y _ {i} + \frac {h \cdot 4 3 9 \cdot k 1}{2 1 6} - h \cdot 8 \cdot k 2 + \frac {h \cdot 3 6 8 0 \cdot k 3}{5 1 3} - \frac {h \cdot 8 4 5 \cdot k 4}{4 1 0 4}\right) \\ k 6 \leftarrow D \left(z _ {i} + \frac {h}{2}, y _ {i} - \frac {h \cdot 8 \cdot k 1}{2 7} + h \cdot 2 \cdot k 2 - \frac {h \cdot 3 5 4 4 \cdot k 3}{2 5 6 5} + \frac {h \cdot 1 8 5 9 \cdot k 4}{4 1 0 4} - \frac {h \cdot 1 1 \cdot k 4}{4 0}\right) \\ w _ {i + 1} \leftarrow y _ {i} + h \cdot \left(\frac {2 5 \cdot k 1}{2 1 6} + \frac {1 4 0 8 \cdot k 3}{2 5 6 5} + \frac {2 1 9 7 \cdot k 4}{4 1 0 1} - \frac {k 5}{5}\right) \\ z _ {i + 1} \leftarrow y _ {i} + h \cdot \left(\frac {1 6 \cdot k 1}{1 3 5} + \frac {6 6 5 6 \cdot k 3}{1 2 8 2 5} + \frac {2 8 5 6 1 \cdot k 4}{5 6 4 3 0} - \frac {9 \cdot k 5}{5 0} + \frac {2 \cdot k 6}{5 5}\right) \\ y _ {i + 1} \leftarrow z _ {i + 1} \\ h \leftarrow \left(\frac {h \cdot 1 0 ^ {- 2}}{\left| z _ {i + 1} - w _ {i + 1} \right|}\right) ^ {\frac {1}{4}} \cdot h \cdot 0.84 \end{array}


Error calculation.

T - exact value

AT - approximation

TAT=7.80215501191E005\left| T - AT \right| = 7.80215501191E-005

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