Introduction : We will apply numerical method to solve ode dy/dx=sqrt(x^2+y^2) with y(1)=2 known as Euler method. This method produces numerical solutions using iterations at the different points of domain.
Question: If the differential equation \(\frac{dy}{dx} =\sqrt{x^2+y^2}, y(1) =2\) is solved using Euler Method with stepsize \( h = 0.1\) then find \(y(1.2) \) round off to 2 decimal places.\[\]
Solution:
To solve \(y'(x)=\sqrt{x^2+y^2} , y(1) = 2\)
\[\Rightarrow f(x, y) = \sqrt{x^2+y^2} , x_0 = 1, y_0 = 2\]
Euler’s Method approximates solution of the differential equation as follows
\[ y(x_{n+1}) = y_{n+1} = y_{n}+h*f( x_{n} y_{n}) \forall n\ge 0\]
Where \( x_{n+1} = x_n+h , y_{n+1} = y(x_{n+1}) \)
Substitute \( h = 0.1 , f(x_n , y_n ) = \sqrt{x_n^2+y_n^2} \)
\[\Rightarrow y(x_{n+1}) = y_{n+1} = y_{n}+0.1*\sqrt{x_n^2+y_n^2} \forall n\ge 0\]
First iteration : \( n = 0 , x_0 = 1, y_0 = 2\)
\( \Rightarrow x_{1} = x_{0}+h = 1+0.1 = 1.1\)
\[ \Rightarrow y\left(x_{1}\right) = y\left( 1.1 \right) = y_{1} = y_{0}+0.1 \cdot f \left(x_{0}, y_{0} \right) \]
\[= 2+0.1 \cdot \sqrt{1^2+2^2} = 2 + 0.1 \cdot \sqrt{1+4} = 2.224 \]
\[ \Rightarrow y_{1} = y\left( 1.1 \right) = 2.224\]
Second iteration : \(n = 1 , x_ = 1.1 , y_1 = 2.224\)
\[ \Rightarrow x_{2} = x_{1}+ 0.1 = 1.1+0.1 = 1.2\]
\[ y\left(x_{2}\right) = y\left( 1.2 \right) = y_{2} = y_{1}+0.1 \cdot f \left(x_{1}, y_{1} \right) \]
\[ = 2.224+0.1 \cdot\sqrt{1.1^2+2.224^2} = 2.224+0.249 = 2.474 \]
\[ \Rightarrow y_{2} = y(1.2)= 2.474 \]
Thus \(y(1.2) = 2.474\).