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 d T ( t ) / d t dT(t)/dt d T ( t ) / d t , is (by Newton's Law of Cooling) proportional to the difference between the temperature of the object T ( t ) T(t) T ( t ) and the ambient temperature T a Ta T a . This means that:
d T ( t ) d t = − r ( T ( t ) − T a ) , r − positive constant characteristic of the system \frac{dT(t)}{dt} = -r(T(t) - Ta), \quad r - \text{positive constant characteristic of the system} d t d T ( t ) = − r ( T ( t ) − T a ) , r − positive constant characteristic of the system
The analytical solution of this differential equation:
T ( t ) = T a + C ⋅ e − r t T(t) = Ta + C \cdot e^{-rt} T ( t ) = T a + C ⋅ e − r t
Let for t = 0 t = 0 t = 0 , T ( 0 ) = 90 T(0) = 90 T ( 0 ) = 90 and r = 0.1 r = 0.1 r = 0.1 and T a = 30 Ta = 30 T a = 30 then:
d T ( t ) d t = − 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 d t d T ( t ) = − 0.1 ( T ( t ) − 30 ) with IVP: T ( 0 ) = 90
And exact solution:
T ( t ) = 30 + 60 ⋅ e − 0.1 ⋅ t T(t) = 30 + 60 \cdot e^{-0.1 \cdot t} T ( t ) = 30 + 60 ⋅ e − 0.1 ⋅ t
The Runge-Kutta-Fehlberg method is single-step method. This method has a procedure to determine whether the correct step size h h h is used. Each step requires the use of the following six values:
k 1 = h ⋅ f ( x k , y k ) k_1 = h \cdot f(x_k, y_k) k 1 = h ⋅ f ( x k , y k ) k 2 = h ⋅ f ( x k + 1 4 h , y k + 1 4 k 1 ) k_2 = h \cdot f\left(x_k + \frac{1}{4}h, y_k + \frac{1}{4}k_1\right) k 2 = h ⋅ f ( x k + 4 1 h , y k + 4 1 k 1 ) k 3 = h ⋅ f ( x k + 3 8 h , y k + 3 32 k 1 + 9 32 k 2 ) 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) k 3 = h ⋅ f ( x k + 8 3 h , y k + 32 3 k 1 + 32 9 k 2 ) k 4 = h ⋅ f ( x k + 12 13 h , y k + 1932 2197 k 1 − 7200 2197 k 2 + 7296 2197 k 3 ) 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) k 4 = h ⋅ f ( x k + 13 12 h , y k + 2197 1932 k 1 − 2197 7200 k 2 + 2197 7296 k 3 ) k 5 = h ⋅ f ( x k + h , y k + 439 216 k 1 − 8 k 2 + 3680 513 k 3 − 845 4104 k 4 ) 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) k 5 = h ⋅ f ( x k + h , y k + 216 439 k 1 − 8 k 2 + 513 3680 k 3 − 4104 845 k 4 ) k 6 = h ⋅ f ( x k + 1 2 h , y k − 8 27 k 1 + 2 k 2 − 3544 2565 k 3 + 1859 4104 k 4 − 11 40 k 5 ) 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) k 6 = h ⋅ f ( x k + 2 1 h , y k − 27 8 k 1 + 2 k 2 − 2565 3544 k 3 + 4104 1859 k 4 − 40 11 k 5 )
Then we calculate the approximation to the solution with the help of the method of the fourth order:
w k + 1 = y k + 25 216 k 1 + 1408 2565 k 3 + 2197 4101 k 4 − 1 5 k 5 , E r r o r = O ( h 4 ) 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) w k + 1 = y k + 216 25 k 1 + 2565 1408 k 3 + 4101 2197 k 4 − 5 1 k 5 , E rror = O ( h 4 )
And the approximation to the solution with the help of the method of the 5th order:
y k + 1 = y k + 16 135 k 1 + 6656 12825 k 3 + 28561 56430 k 4 − 9 50 k 5 + 2 55 k 6 , E r r o r = O ( h 5 ) 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) y k + 1 = y k + 135 16 k 1 + 12825 6656 k 3 + 56430 28561 k 4 − 50 9 k 5 + 55 2 k 6 , E rror = 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) ( δ ⋅ h ) .
R = 1 h ∣ w k + 1 − y k + 1 ∣ , δ = ( ε 2 R ) 1 4 ε − s p e c i f i e d a c c u r a c y R = \frac{1}{h} |w_{k+1} - y_{k+1}|, \quad \delta = \left(\frac{\varepsilon}{2R}\right)^{\frac{1}{4}} \varepsilon - specified\ accuracy R = h 1 ∣ w k + 1 − y k + 1 ∣ , δ = ( 2 R ε ) 4 1 ε − s p ec i f i e d a cc u r a cy
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:
k 3 = f ( x k + 1 2 h , y k + 1 2 k 2 ) k _ {3} = f \left(x _ {k} + \frac {1}{2} h, y _ {k} + \frac {1}{2} k _ {2}\right) k 3 = f ( x k + 2 1 h , y k + 2 1 k 2 ) k 4 = f ( x k + h , y k + h k 3 ) k _ {4} = f \left(x _ {k} + h, y _ {k} + h k _ {3}\right) k 4 = f ( x k + h , y k + h k 3 )
Then we calculate the approximation to the solution with the help of the method of the fourth order:
y k + 1 = y k + h 6 ( k 1 + 2 k 2 + 2 k 3 + k 4 ) y _ {k + 1} = y _ {k} + \frac {h}{6} \left(k _ {1} + 2 k _ {2} + 2 k _ {3} + k _ {4}\right) y k + 1 = y k + 6 h ( k 1 + 2 k 2 + 2 k 3 + k 4 )
Problem solving and error analysis:
R u n g e 4 ( y 0 , s t e p , D ) : = { ( x 0 ← 0 y 0 ← y 0 h ← s t e p ) f o r i ∈ 0.100 [ x i + 1 ← x i + h k 1 ← D ( x i , y i ) k 2 ← D ( x i + h 2 , y i + h ⋅ k 1 2 ) k 3 ← D ( x i + h 2 , y i + h ⋅ k 2 2 ) k 4 ← D ( x i + h , y i + h ⋅ k 3 ) y i + 1 ← y i + h ( k 1 + 2 ⋅ k 2 + 2 ⋅ k 3 + k 4 6 ) r e t u r n a u g m e n t ( 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} Runge4 ( y0 , step , D ) := ⎩ ⎨ ⎧ ( x 0 ← 0 y 0 ← y 0 h ← step ) fori ∈ 0.100 ⎣ ⎡ x i + 1 ← x i + h k 1 ← D ( x i , y i ) k 2 ← D ( x i + 2 h , y i + 2 h ⋅ k 1 ) k 3 ← D ( x i + 2 h , y i + 2 h ⋅ k 2 ) k 4 ← D ( x i + h , y i + h ⋅ k 3 ) y i + 1 ← y i + h ( 6 k 1 + 2 ⋅ k 2 + 2 ⋅ k 3 + k 4 ) returnaugment ( x , y )
Error calculation.
T - exact value
AT - approximation
Z : = Runge 4 ( y 0 , 0.15 , D ) Z := \operatorname {R u n g e} 4 \left(y _ {0}, 0. 1 5, D\right) Z := Runge 4 ( y 0 , 0.15 , D ) i : = 0 … r o w s ( Z ) − 1 t i m e i : = Z i , 0 T i : = f T ( t i m e i ) A T i : = Z i , 1 ∣ T − A T ∣ = 0.0000008016 i := 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 i := 0 … r o w s ( Z ) − 1 t i m e i := Z i , 0 T i := f T ( t i m e i ) A T i := Z i , 1 ∣ T − A T ∣ = 0.0000008016
Answer provided by https://www.AssignmentExpert.com
Comments