Euler's Method for Approximating Solutions to Diff. Eqs. Examples 1

Euler's Method for Approximating Solutions to Differential Equations Examples 1

Recall from the Euler's Method for Approximating Solutions to Differential Equations page that if we have a first order differential equation $\frac{dy}{dt} = f(t, y)$ with the initial condition $y(t_0) = y_0$. If it is difficult to solve this first order differential equation, then sometimes we can use Euler's Method to find approximations $y_n$ of $\phi(t_n)$ with equations of lines that pass through the points $(t_n, y_n)$ with slopes $f(t_n, y_n)$ given by:

(1)
\begin{align} \quad y = y_n + f(t_n, y_n)(t - t_n) \end{align}

And the values of $y_{n+1}$ can be computed with the formula:

(2)
\begin{align} \quad y_{n+1} = y_n + f(t_n, y_n) (t_{n+1} - t_n) \end{align}

Furthermore, if the difference between consecutive values $v_j$ and $v_{j+1}$ is $h$ (the step size from one $v_j$ to the next is $h$) then the approximations $y_{n+1}$ of $\phi(t_{n+1})$ can be obtained by the formula:

(3)
\begin{align} \quad y_{n+1} = y_n + f(t_n, y_n) h \end{align}

We will now look at some more examples of using Euler's Method to approximate the solutions to differential equations.

Example 1

Consider the first order differential equation $\frac{dy}{dt} = t^2 + y^2$ with the initial condition $y(0)=1$. Approximate the values of the unique solution $y = \phi (t)$ for this initial value problem using Euler's Method at the values $t=0.1,0.2,0.3,0.4, 0.5$ with the step size $h=0.1$.

Let $f(t, y) = \frac{dy}{dt} = t^2 + y^2$.

The tangent line that passes through the point $(0, 1)$ (given by the initial condition $y(0) = 1$) has the slope $f(0, 1) = 1^2 = 1$. Therefore the equation of this tangent line is:

(4)
\begin{align} \quad y = 1 + 1(t - 0) \end{align}

We will now use this line in order to approximate the value of $\phi(0.1)$. Plugging in $0.1$ to the tangent line above and we get that:

(5)
\begin{align} \quad y_1 = 1 + 1(0.1) \\ \quad y_1 = 1.1 \end{align}

We thus obtain the point $(0.1,1.1)$ as an approximation of $\phi(0.1)$. The slope of the tangent line that passes through this point is $f(0.1,1.1)=(0.1)^2 + (1.1)^2 = 1.22$. Therefore the equation of this tangent line is:

(6)
\begin{align} \quad y = 1.1 + 1.22(t - 0.1) \end{align}

We will now use this line in order to approximate the value of $\phi(0.2)$. Plugging in $0.2$ to the tangent line above and we get that:

(7)
\begin{align} \quad y_2 = 1.1 + 1.22(0.2 - 0.1) \\ \quad y_2 = 1.222 \end{align}

We thus obtain the point $(0.2, 1.222)$ as an approximation of $\phi(0.2)$. The slope of the tangent line that passes through this point is $f(0.2, 1.222) = 1.533284$. Therefore the equation of this tangent line is:

(8)
\begin{align} \quad y = 1.222 + 1.533284(t - 0.2) \end{align}

We will now use this line in order to approximate the value of $\phi(0.3)$. Plugging in $0.3$ to the tangent line above and we get that:

(9)
\begin{align} \quad y_3 = 1.222 + 1.533284(0.3 - 0.2) \\ \quad y_3 = 1.3753284 \end{align}

We thus obtain the point $(0.3, 1.3753284)$ as an approximation of $\phi(0.3)$. The slope of the tangent line that passes through this point is $f(0.3, 1.3753284) = 1.9815282$. Therefore the equation of this tangent line is:

(10)
\begin{align} \quad y = 1.3753284 + 1.9815282(t - 0.3) \end{align}

We will now use this line in order to approximate the value of $\phi(0.4)$. Plugging in $0.4$ to the tangent line above and we get that:

(11)
\begin{align} \quad y_4 = 1.3753284 + 1.9815282(0.4 - 0.3) \\ \quad y_4 = 1.5734812 \end{align}

We thus obtain the point $(0.4, 1.5734812)$ as an approximation of $\phi(0.4)$. The slope of the tangent line that passes through this point is $f(0.4, 1.5734812) = 2.6358431$. Therefore the equation of this tangent line is:

(12)
\begin{align} \quad y = 1.5734812 + 2.6358431(t - 0.4) \end{align}

We will now use this line in order to approximate the value of $\phi(0.5)$. Plugging in $0.5$ to the tangent line above and we get that:

(13)
\begin{align} \quad y_5 = 1.5734812 + 2.6358431(0.5 - 0.4) \\ \quad y_5 = 1.8370655 \end{align}

We thus obtain the point $(0.5, 1.8370655)$ as an approximation of $\phi(0.5)$.

Screen%20Shot%202015-03-10%20at%206.59.14%20AM.png

The graph above shows the direction field of the differential equation $\frac{dy}{dt} = t^2 + y^2$ alongside the piecewise linear approximation curve (in red) creating by joining the line segments from the points $(t_0, y_0)$, $(t_1, y_1)$, …, $(t_5, y_5)$ obtained from Euler's Method which approximates the actual solution $y = \phi(t)$ to our initial value problem.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License