Navigation

Qualitative methods for differential equations

12.3 Euler's method

11 problems · hints, answers and solutions shown beside each one

Euler's method. Solve the decay equation in Example 12.3.2 in the text analytically. That is, find the formula for the solution to

dydt=0.5y, y(0)=100\diff{y}{t}=-0.5y,~y(0)=100

in terms of a decaying exponential, and then use a calculator to compare your values to the approximate solution values y1y_1 and, y2y_2 computed with Euler's method in Table 12.4 in the text.

Answer
k\boldsymbol{k}tk\boldsymbol{t_{k}}yk\boldsymbol{y_{k}}actual value of y(tk)\boldsymbol{y(t_k)}
\hdashline[0.5pt/2pt] 00100.00100
10.195.00100e0.0595.12100e^{-0.05} \approx 95.12
20.290.25100e0.190.48100e^{-0.1} \approx 90.48

Comparing approximate and true solutions. For this question, you may use a calculator.

  1. Use Euler's method to find an approximate solution to the differential equation

    dydx=y\frac{dy}{dx} = y

    with y(0)=1y(0)= 1. Use a step size h=0.1h=0.1 and find the values of yy up to x=0.5x=0.5. Compare the value you have calculated for y(0.5)y(0.5) using Euler's method with the true solution of this differential equation. What is the error i.e. the difference between the true solution and the approximation?

  2. Now use Euler's method on the differential equation

    dydx=y\frac{dy}{dx} = - y

    with y(0)=1y(0)= 1. Use a step size h=0.1h=0.1 again and find the values of yy up to x=0.5x=0.5. Compare the value you have calculated for y(0.5)y(0.5) using Euler's method with the true solution of this differential equation. What is the error this time?

Answer
  1. y5=1.61051y_{5}=1.61051; y(0.5)=1.6487213y(0.5)=1.6487213; error =0.03821=0.03821

  2. y5=0.59049y_{5}=0.59049; y(0.5)=0.60653y(0.5)=0.60653; error =0.01604=0.01604

Beginning Euler's method. Give the first 3 steps of Euler's method for the problem in Example 12.3.4 in the text.

Approximate y(0.5)y(0.5) if y(t)y(t) satisfies the differential equation

dydt=y21y2+1\diff{y}{t}=\frac{y^2-1}{y^2+1}

and the initial condition

y(0)=0y(0)=0

using a (simple) calculator or a spreadsheet, and the following step sizes in Euler's method.

  • Approximate y(0.5)y(0.5) using Δt=0.5\Delta t = 0.5.

  • Approximate y(0.5)y(0.5) using Δt=0.25\Delta t = 0.25.

  • Approximate y(0.5)y(0.5) using Δt=0.1\Delta t = 0.1.

Answer
  • Using Δt=0.5\Delta t = 0.5, y(0.5)0.5y(0.5) \approx-0.5.

  • Using Δt=0.25\Delta t = 0.25, y(0.5)0.4705882353y(0.5) \approx -0.4705882353.

  • Using Δt=0.1\Delta t = 0.1, y(0.5)0.450264102y(0.5) \approx -0.450264102.

Given the initial-value problem

dydt=yt,y(0)=0\diff{y}{t}=y-t, \qquad y(0)=0

use Euler's method with three steps to approximate y(0.03)y(0.03).

Answer

y(0.03)0.000301y(0.03)\approx -0.000301

Full solution

To get from 00 to 0.030.03 in three steps, we use Δt=0.01=1100\Delta t = 0.01=\frac{1}{100}.

tyy0000.010+(0.01)(0)y+Δxy=000.01yt=0.01=11000.020+1100(1100)y+Δxy=110411042100yt=2011040.031104+1100(201104)y+Δxy=301106\begin{array}{l|l|l} t & y & y'\\ \hline 0 & 0 & 0\\ 0.01 & \underbrace{0+(0.01)(0)}_{y+\Delta x \cdot y'}=0 & \underbrace{0-0.01}_{y-t} = -0.01=-\frac{1}{100}\\ 0.02 & \underbrace{0+\frac{1}{100}\left(-\frac1{100}\right)}_{y+\Delta x \cdot y'} = -\frac{1}{10^4} & \underbrace{- \frac{1}{10^4}-\frac{2}{100}}_{y-t}=-\frac{201}{10^4}\\ 0.03 & \underbrace{-\frac1{10^4}+\frac{1}{100}\left(-\frac{201}{10^4}\right)}_{y+\Delta x \cdot y'}=-\frac{301}{10^6} \end{array}

Note 301106=0.000301-\frac{301}{10^6}=-0.000301.

Given the initial-value problem

dydt=y+t,y(0)=0\diff{y}{t}=y+t, \qquad y(0)=0

use Euler's method with three steps to approximate y(0.03)y(0.03). You may use a (simple) calculator or a spreadsheet.

Answer

y(0.03)0.000301y(0.03)\approx 0.000301

Full solution

To get from 00 to 0.030.03 in three steps, we use Δt=0.01=1100\Delta t = 0.01=\frac{1}{100}.

tyy0000.010+(0.01)(0)y+Δxy=00+0.01y+t=0.01=11000.020+1100(1100)y+Δxy=11041104+2100y+t+2011040.031104+1100(201104)y+Δxy=301106\begin{array}{l|l|l} t & y & y'\\ \hline 0 & 0 & 0\\ 0.01 & \underbrace{0+(0.01)(0)}_{y+\Delta x \cdot y'}=0 & \underbrace{0+0.01}_{y+t} = 0.01=\frac{1}{100}\\ 0.02 & \underbrace{0+\frac{1}{100}\left(\frac1{100}\right)}_{y+\Delta x \cdot y'} = \frac{1}{10^4} & \underbrace{ \frac{1}{10^4}+\frac{2}{100}}_{y+t}+\frac{201}{10^4}\\ 0.03 & \underbrace{\frac1{10^4}+\frac{1}{100}\left(\frac{201}{10^4}\right)}_{y+\Delta x \cdot y'}=\frac{301}{10^6} \end{array}

Note 301106=0.000301\frac{301}{10^6}=0.000301.

Given the initial-value problem

dydt=ty,y(0)=1\diff{y}{t}=\frac{t}{y}, \qquad y(0)=1

use Euler's method with three steps to approximate y(0.03)y(0.03). You may use a (simple) calculator or a spreadsheet.

Answer

y(0.03)1.00029998y(0.03)\approx 1.00029998

Given the initial-value problem

dydt=t,y(0)=0\diff{y}{t}=\sqrt{t}, \qquad y(0)=0

use Euler's method with two steps to approximate y(1)y(1).

Answer

y(1)122y(1)\approx\frac{1}{2\sqrt2}

Full solution

To get from x=0x=0 to x=1x=1 in two steps, we use Δx=12\Delta x = \frac12.

tyy000121+12(0)y+Δxy=012t10+1212y+Δxy=122\begin{array}{l|l|l} t& y & y'\\ \hline 0 & 0 & 0\\ \frac12 & \underbrace{1+\frac12(0)}_{y+\Delta x \cdot y'}=0 & \underbrace{\sqrt{\frac12}}_{\sqrt{t}}\\ 1 & \underbrace{0+\frac12\cdot\sqrt{\frac12}}_{y+\Delta x \cdot y'}= \dfrac{1}{2\sqrt 2} \end{array}

Given the initial-value problem

dydt=y,y(0)=0\diff{y}{t}=\sqrt{y}, \qquad y(0)=0

use Euler's method with two steps to approximate y(1)y(1).

Answer

y(1)0y(1)\approx 0 (actually: y(1)=0y(1)=0)

Full solution

To get from x=0x=0 to x=1x=1 in two steps, we'll use Δx=12\Delta x = \frac12.

tyy000120+12(0)=0010+12(0)=0\begin{array}{l|l|l} t & y & y' \\ \hline 0 & 0 & 0\\ \frac12 & 0+\frac12(0) =0& 0\\ 1 & 0+\frac12(0)=0 \end{array}

Note: what's happened is that we chanced upon a steady state solution: the constant solution y=0y=0 is the solution to the initial value problem. So in this case, our approximation is actually exact.

Given the initial-value problem

dydt=y,y(2)=1\diff{y}{t}=\sqrt{y}, \qquad y(2)=1

use Euler's method with two steps to approximate y(3)y(3).

Answer

y(3)32+1232y(3)\approx \frac32+\frac12\cdot\sqrt{\frac32}

Full solution

To get from x=2x=2 to x=3x=3 in two steps, we'll use Δx=12\Delta x = \frac12.

tyy2112.51+12(1)=3232332+1232\begin{array}{l|l|l} t & y & y' \\ \hline 2 & 1 & 1\\ 2.5 & 1+\frac12(1) =\frac32& \sqrt{\frac32}\\ 3 & \frac32+\frac12\cdot\sqrt{\frac32} \end{array}

Suppose y(1.1)=17y(1.1)=\frac17 and

dydt=yt.\diff{y}{t}=\frac{y}{t}.

Use three steps of Euler's method to approximate y(1.5).y(1.5). You may use a (simple) calculator or a spreadsheet.

Answer

y(1.5)15770.1948051948y(1.5) \approx \frac{15}{77} \approx 0.1948051948 (actually, the value is exact)

Full solution

To get from x=1.1x=1.1 to x=1.5x=1.5 in three equal steps, each step should be Δx=1.51.13=0.43=430\Delta x = \frac{1.5-1.1}{3}=\frac{0.4}{3}=\frac{4}{30}.

tyy1.1171/71.1yt=17.7=10771.1+215=3.7317+21517.7y+Δxy=3723137/23137/30yt=30231=10771.1+0.83=4.1337231+21530231y+Δxy=4123141/23130/41yt=30231=10771.1+1.23=1.541231+21530231y+Δx+y=45231=1577\begin{array}{l|l|l} t & y & y'\\ 1.1 & \frac17 & \underbrace{\frac{1/7}{1.1}}_{\frac{y}{t}}=\dfrac{1}{7.7}=\dfrac{10}{77} \\ 1.1+\frac{2}{15}=\frac{3.7}{3}& \underbrace{\frac17+\frac{2}{15}\cdot\frac{1}{7.7}}_{y+\Delta x \cdot y'} =\dfrac{37}{231}& \underbrace{\frac{37/231}{37/30}}_{\frac{y}{t}}=\dfrac{30}{231}=\dfrac{10}{77} \\ 1.1+\frac{0.8}{3}=\frac{4.1}{3}&\underbrace{\frac{37}{231}+\frac{2}{15}\cdot\frac{30}{231}}_{y+\Delta x \cdot y'}=\dfrac{41}{231}& \underbrace{\frac{41/231}{30/41}}_{\frac{y}{t}}=\dfrac{30}{231}=\dfrac{10}{77} \\ 1.1+\frac{1.2}{3}=1.5 &\underbrace{\frac{41}{231}+\frac{2}{15}\cdot\frac{30}{231}}_{y+\Delta x + y'}=\dfrac{45}{231}=\dfrac{15}{77} \end{array}

Remark: the exact solution to this initial value problem is y(t)=1077ty(t) = \frac{10}{77}t, which is a line (and so has constant slope). Note the slopes in the table are constant as well. Furthermore, our `approximate' value for y(1.5)y(1.5) turns out to be the exact value of y(1.5)y(1.5).

Source

Questions 1 through 3 are from Keshet, Chaper 12, which intentionally omits some answers. Other questions are original content.

From the UBC Math 100 open textbook project, © Joel Feldman, Andrew Rechnitzer, Elyse Yeager and others. Licensed CC BY-NC-SA 4.0; this HTML adaptation is released under the same licence. Full attribution.