Q14E

Question

Use the fourth-order Runge–Kutta algorithm to approximate the solution to the initial value problem\({\bf{y' = ycosx,y(0) = 1}}\) , at \({\bf{x = \pi }}\). For a tolerance of \({\bf{\varepsilon  = 0}}{\bf{.01}}\) use a stopping procedure based on the absolute error.

Step-by-Step Solution

Verified
Answer

\(\phi {\bf{(}}\pi {\bf{) = 1}}\)  

1Step 1: Find the values of \({{\bf{k}}_{\bf{i}}}{\bf{.i = 1,2,3,4}}\)

Using the improved 4th order Runge-Kutta subroutine.

 

Since \({\bf{f(x,y) = y}}\;{\bf{cos}}\;{\bf{x}}\) and \({\bf{x = }}{{\bf{x}}_{\bf{0}}}{\bf{ = 0,y = }}{{\bf{y}}_{\bf{o}}}{\bf{ = 1}}\) and h = 3.141593, M = 10

 

\(\begin{array}{c}{{\bf{k}}_{\bf{1}}}{\bf{ = h}}{\rm{f}}{\bf{(x,y) = 3}}{\bf{.141593(y}}\;{\bf{cos}}\;{\bf{x)}}\\{{\bf{k}}_{\bf{2}}}{\bf{ = hf}}\left( {{\bf{x + }}\frac{{\bf{h}}}{{\bf{2}}}{\bf{,y + }}\frac{{{{\bf{k}}_{\bf{1}}}}}{{\bf{2}}}} \right){\bf{ = 3}}{\bf{.141593}}\left( {{\bf{y + }}\frac{{{{\bf{k}}_{\bf{1}}}}}{{\bf{2}}}} \right){\bf{cos(x + 1}}{\bf{.570795)}}\\{{\bf{k}}_{\bf{3}}}{\bf{ = hf}}\left( {{\bf{x + }}\frac{{\bf{h}}}{{\bf{2}}}{\bf{,y + }}\frac{{{{\bf{k}}_{\bf{2}}}}}{{\bf{2}}}} \right){\bf{ = 3}}{\bf{.141593}}\left( {{\bf{y + }}\frac{{{{\bf{k}}_{\bf{2}}}}}{{\bf{2}}}} \right){\bf{cos(x + 1}}{\bf{.570795)}}\\{{\bf{k}}_{\bf{4}}}{\bf{ = hf}}\left( {{\bf{x + h,y + }}{{\bf{k}}_{\bf{3}}}} \right){\bf{ = 3}}{\bf{.141593(y + }}{{\bf{k}}_{\bf{3}}}{\bf{)cos(x + 3}}{\bf{.141593)}}\\{{\bf{k}}_{\bf{1}}}{\bf{ = h(x,y) = 3}}{\bf{.141593}}\\{{\bf{k}}_{\bf{2}}}{\bf{ = hf}}\left( {{\bf{x + }}\frac{{\bf{h}}}{{\bf{2}}}{\bf{,y + }}\frac{{{{\bf{k}}_{\bf{1}}}}}{{\bf{2}}}} \right){\bf{ = 0}}\\{{\bf{k}}_{\bf{3}}}{\bf{ = hf}}\left( {{\bf{x + }}\frac{{\bf{h}}}{{\bf{2}}}{\bf{,y + }}\frac{{{{\bf{k}}_{\bf{2}}}}}{{\bf{2}}}} \right){\bf{ = 0}}\\{{\bf{k}}_{\bf{4}}}{\bf{ = hf}}\left( {{\bf{x + h,y + }}{{\bf{k}}_{\bf{3}}}} \right){\bf{ =  - 3}}{\bf{.141593}}\end{array}\)

2Step 2: Find the values of x and y

\(\begin{array}{c}{\bf{x = 0 + 3}}{\bf{.141593 = 1}}{\bf{.005}}\\{\bf{y = 1 + }}\frac{{\bf{1}}}{{\bf{6}}}\left( {{{\bf{k}}_{\bf{1}}}{\bf{ + 2}}{{\bf{k}}_{\bf{2}}}{\bf{ + 2}}{{\bf{k}}_{\bf{3}}}{\bf{ + }}{{\bf{k}}_{\bf{4}}}} \right)\\{\bf{ = 1}}\end{array}\)

 

Therefore \(\phi {\bf{(}}\pi {\bf{) = y(}}\pi {\bf{;}}\pi {\bf{) = 1}}\)

 

\(\left| {{\bf{1 - 1}}} \right|{\bf{ = 0 < 0}}{\bf{.01}}\)

 

So \(\phi {\bf{(}}\pi {\bf{) = 1}}\)  with tolerance \(\xi {\bf{ = 0}}{\bf{.01}}\) where \(\phi {\bf{(x)}}\) is the solution of the given IVP.

 

Hence the solution is  \(\phi {\bf{(}}\pi {\bf{) = 1}}\)