Differential Equations : Euler Method

Study concepts, example questions & explanations for Differential Equations

varsity tutors app store varsity tutors android store

Example Questions

Example Question #1 : Euler Method

Use Euler's Method to calculate the approximation of \(\displaystyle y(0.2)\) where \(\displaystyle y(x)\) is the solution of the initial-value problem that is as follows.

\(\displaystyle y''+xy'+y=0\)

\(\displaystyle y(0)=2, y'(0)=3\)

Possible Answers:

\(\displaystyle y(0.2)\approx2.584\)

\(\displaystyle y(0.2)\approx2.458\)

\(\displaystyle y(0.2)\approx2.542\)

\(\displaystyle y(0.2)\approx2.58\)

\(\displaystyle y(0.2)\approx2.5\)

Correct answer:

\(\displaystyle y(0.2)\approx2.58\)

Explanation:

Using Euler's Method for the function

\(\displaystyle y''+xy'+y=0\)

\(\displaystyle y(0)=2, y'(0)=3\)

first make the substitution of

\(\displaystyle \\y'=u \\u'=-xu-y\)

therefore

\(\displaystyle \\y_{n+1}=y_n+hu_n \\u_{n+1}=u_n+h[-x_nu_n-y_n]\)

where \(\displaystyle h\) represents the step size.

Let 

\(\displaystyle \\h=0.1 \\y_0=2 \\u_0=3\)

Substitute these values into the previous formulas and continue in this fashion until the approximation for \(\displaystyle y(0.2)\) is found.

\(\displaystyle \\y_1=y_0+(0.1)u_0=2+(0.1)(3)=2.3 \\u_1=u_0+(0.1)[-x_0u_0-y_0]=3+(0.1)[0(2)-2]=2.8 \\y_2=y_1+(0.1)u_1=2.3+(0.1)(2.8)=2.58 \\u_2=u_1+(0.1)[-x_1u_1-y_1]=2.8+(0.1)[-0.1(2.8)-2.3]=2.542\)

Therefore,

\(\displaystyle y(0.2)\approx2.58\)

Example Question #1 : Euler Method

Approximate \(\displaystyle y(\pi)\) for \(\displaystyle y = \cos(y)(2-y)\) with time steps \(\displaystyle h = \frac{\pi}{4}\) and \(\displaystyle y(0) = 0\).

Possible Answers:

\(\displaystyle \frac{\pi}{4}\)

\(\displaystyle 0\)

\(\displaystyle \frac{\pi}{2}\)

\(\displaystyle \frac{3\pi}{2}\)

\(\displaystyle \frac{5\pi}{8}\)

Correct answer:

\(\displaystyle \frac{\pi}{2}\)

Explanation:

Approximate \(\displaystyle y(\pi)\) for \(\displaystyle y = \cos(y)(2-y)\) with time steps \(\displaystyle h = \frac{\pi}{4}\) and \(\displaystyle y(0) = 0\).

 

The formula for Euler approximations \(\displaystyle \mu(t+h) = \mu (t) + h \cdot f(t, \mu(t))\).

Plugging in, we have 

\(\displaystyle \mu(\frac{\pi}{4}) = \mu (0) + \frac{\pi}{4}f(0, \mu(0)) = 0 + \frac{\pi}{4}(\cos(0)(2-0)) = \frac{\pi}{2}\)

 \(\displaystyle \mu(\frac{\pi}{2}) = \mu (\frac{\pi}{4}) + \frac{\pi}{4}f(\frac{\pi}{4}, \mu(\frac{\pi}{4})) = \frac{\pi}{2} + \frac{\pi}{4}(\cos(\frac{\pi}{2})(2-\frac{\pi}{2})) = \frac{\pi}{2} + 0 = \frac{\pi}{2}\)

Here we can see that we've gotten trapped on a horizontal tangent (a failing of Euler's method when using larger time steps). As the function is not dependent on t, we will continue to move in a horizontal line for the rest of our Euler approximations. Thus \(\displaystyle \mu(\pi) = \frac{\pi}{2} \approx y(\pi)\).

 

Example Question #1 : Euler Method

Use Euler's Method to calculate the approximation of \(\displaystyle y(0.2)\) where \(\displaystyle y(x)\) is the solution of the initial-value problem that is as follows.

\(\displaystyle y''+xy'+y=0\)

\(\displaystyle y(0)=2, y'(0)=3\)

Possible Answers:

\(\displaystyle y(0.2)\approx2.58\)

\(\displaystyle y(0.2)\approx2.584\)

\(\displaystyle y(0.2)\approx2.542\)

\(\displaystyle y(0.2)\approx2.5\)

\(\displaystyle y(0.2)\approx2.458\)

Correct answer:

\(\displaystyle y(0.2)\approx2.58\)

Explanation:

Using Euler's Method for the function

\(\displaystyle y''+xy'+y=0\)

\(\displaystyle y(0)=2, y'(0)=3\)

first make the substitution of

\(\displaystyle \\y'=u \\u'=-xu-y\)

therefore

\(\displaystyle \\y_{n+1}=y_n+hu_n \\u_{n+1}=u_n+h[-x_nu_n-y_n]\)

where \(\displaystyle h\) represents the step size.

Let 

\(\displaystyle \\h=0.1 \\y_0=2 \\u_0=3\)

Substitute these values into the previous formulas and continue in this fashion until the approximation for \(\displaystyle y(0.2)\) is found.

\(\displaystyle \\y_1=y_0+(0.1)u_0=2+(0.1)(3)=2.3 \\u_1=u_0+(0.1)[-x_0u_0-y_0]=3+(0.1)[0(2)-2]=2.8 \\y_2=y_1+(0.1)u_1=2.3+(0.1)(2.8)=2.58 \\u_2=u_1+(0.1)[-x_1u_1-y_1]=2.8+(0.1)[-0.1(2.8)-2.3]=2.542\)

Therefore,

\(\displaystyle y(0.2)\approx2.58\)

Example Question #1 : Euler Method

Use the implicit Euler method to approximate \(\displaystyle y(3)\) for \(\displaystyle y' = 5y\), given that \(\displaystyle y(0) = 4\), using a time step of \(\displaystyle h = 1.\)

Possible Answers:

\(\displaystyle \frac{1}{32}\)

\(\displaystyle 16\)

\(\displaystyle -\frac{1}{16}\)

\(\displaystyle \frac{1}{16}\)

\(\displaystyle -16\)

Correct answer:

\(\displaystyle -\frac{1}{16}\)

Explanation:

In the implicit method, the amount to increase is given by \(\displaystyle h \cdot f(t_{i+1}, y_{i+1})\), or in this case \(\displaystyle \mu_i = \mu_{i-1}+ 1 \cdot (5\mu_i)\). Note, you can't just plug in to this form of the equation, because it's implicit: \(\displaystyle \mu_i\) is on both sides. Thankfully, this is an easy enough form that you can solve explicitly. Otherwise, you would have to use an approximation method like newton's method to find \(\displaystyle \mu_i\). Solving explicitly, we have \(\displaystyle -4\mu_i = \mu_{i-1}\) and \(\displaystyle \mu_i = -\frac{\mu_{i-1}}{4}\).

Thus, \(\displaystyle y(1) \approx \mu_1 = -\frac{4}{4} = -1\)

\(\displaystyle y(2) \approx \mu_2 = -\frac{-1}{4} = \frac{1}{4}\)

\(\displaystyle y(3) \approx \mu_3 = -\frac{\frac{1}{4}}{4} = -\frac{1}{16}\)

Thus, we have a final answer of \(\displaystyle -\frac{1}{16}\)

Example Question #1 : Numerical Solutions Of Ordinary Differential Equations

Use two steps of Euler's Method with \(\displaystyle h=0.1\) on

\(\displaystyle y' = x\sqrt{y} \ \ \ y(1) = 4\)

To three decimal places

Possible Answers:

4.428

4.420

4.425

4.413

4.408

Correct answer:

4.425

Explanation:

Euler's Method gives us

\(\displaystyle y_{n+1} = y_n + hf(x_n,y_n) = y_n + (0.1)x_n\sqrt{y_n}\)

Taking one step

\(\displaystyle y_1 = y_0 + (0.1)x_0\sqrt{y_0} = 4 + (0.1)(1)\sqrt{4} = 4.2\)

Taking another step

\(\displaystyle y_2 = y_1 + (0.1)x_1\sqrt{y_1} = 4.2 + (0.1)(1.1)\sqrt{4.2} \approx 4.425\)

Learning Tools by Varsity Tutors