Euler’s method to approximate a differential equation $\frac{dy}{dx} = x – y$

approximationcalculuseuler's methodnumerical methodsordinary differential equations

Question: Use Euler's method to find approximate values for the solution of the initial value $-$ problem

$$\frac{dy}{dx} = x-y$$
$$y(0)=1$$
on the interval $[0,1]$ using five steps of size $h = 0.2$.

My attempts:

I know that the recurrence relation $y_{n+1} = y_{n} + hf(x_n,y_n)$ however I am unable to see how the interval comes into play.
An idea I had was to consider the bounds of the interval and approximate $y(0)$ and $y(1)$ however this does not include $h$ so I am extremely skeptical.

Any help or guidance is greatly appreciated!

Best Answer

Make a little table -- I've filled in the first couple of rows for you:

\begin{array}{|c|c|c|c|c|} \hline x & y & \Delta x & \frac{dy}{dx} = x - y & \Delta y \approx \frac{dy}{dx}\Delta x \\ \hline 0 & 1 & 0.2 & -1 & -0.2 \\ \hline 0.2 & 0.8 & 0.2 & -0.6 &-0.12 \\ \hline 0.4 & 0.68 & 0.2 & & \\ \hline 0.6 & &0.2 & & \\ \hline 0.8 & &0.2 & & \\ \hline 1 & & 0.2 & & \\ \hline \end{array}

You are done when you get to the bottom left.

Related Question