Calculus 2 : Euler's Method

Study concepts, example questions & explanations for Calculus 2

varsity tutors app store varsity tutors android store

Example Questions

Example Question #1 : Euler's Method And L'hopital's Rule

Suppose we have the following differential equation with the initial condition:

\(\displaystyle \frac{\partial p }{\partial x} = 0.5x(1-x), \ p(0) = 2\)

Use Euler's method to approximate \(\displaystyle p(2)\), using a step size of \(\displaystyle 1\).

 

 

Possible Answers:

\(\displaystyle 1\)

\(\displaystyle -2\)

\(\displaystyle 2\)

\(\displaystyle -1\)

\(\displaystyle 0\)

Correct answer:

\(\displaystyle 2\)

Explanation:

We start at x = 0 and move to x=2, with a step size of 1. Essentially, we approximate the next step by using the formula:

\(\displaystyle p(x + \Delta x) = p(x) + p'(x)\cdot (\Delta x)\).

So applying Euler's method, we evaluate using derivative: 

\(\displaystyle p'(x) = 0.5x(1-x), \ p(0) = 2\) 

And two step sizes, at x = 1 and x = 2.

\(\displaystyle {}p(x=1) = p(0) + (1 - 0)p'(0) = 2 + 1\cdot p'(0) = 2 + 1 \cdot 0.5(0)(1-0) = 2 + 0 = 2\) 

\(\displaystyle {}p(x=2) = p(1) + (2-1)\cdot p'(1) = 2 + 1\cdot p'(1) = 2 + 0.5(1)(1-1) = 2 + 0 = 2\)

And thus the evaluation of p at x = 2, using Euler's method, gives us p(2) = 2.

Example Question #1 : Euler's Method

Approximate \(\displaystyle \small e^{\frac{1}{2}}\) by using Euler's method on the differential equation

\(\displaystyle \small y'=y\)

with initial condition \(\displaystyle \small y(0)=1\) (which has the solution \(\displaystyle \small y(t)=e^t\)) and time step \(\displaystyle \small \small h=\frac{1}{4}\)

Possible Answers:

\(\displaystyle \small 1.649\)

\(\displaystyle \small 1.5\)

\(\displaystyle \small 1.56\)

\(\displaystyle \small 1.5625\)

Correct answer:

\(\displaystyle \small 1.5625\)

Explanation:

Using Euler's method with \(\displaystyle \small h=1/4\) means that we use two iterations to get the approximation. The general iterative formula is 

\(\displaystyle \small y_{i+1}=y_i+h\cdot f(t_i,y_i)\)

where each \(\displaystyle \small t_i\) is

\(\displaystyle \small t_0=0\)

\(\displaystyle \small t_1=\frac{1}{4}\)

\(\displaystyle \small t_2=\frac{1}{2}\)

 \(\displaystyle \small y_i\) is an approximation of \(\displaystyle \small y(t_i)\), and \(\displaystyle y'=f(t,y)=y\), for this differential equation. So we have

\(\displaystyle \small \small \small \small y_1=y_0+\frac{1}{4}f(t_0,y_0)=1+\frac{1}{4}\cdot 1=1.25\)

\(\displaystyle \small \small \small \small e^{1/2}= y(\frac{1}{2})\approx y_2=y_1+\frac{1}{4}f(t_1,y_1)=1.25+\frac{1}{4}\cdot 1.25=1.5625\)

So our approximation of \(\displaystyle \small e^{1/2}\) is

\(\displaystyle \small e^{1/2}\approx 1.5625\)

Example Question #3 : Euler's Method

Use Euler's method to find the solution to the differential equation \(\displaystyle \frac{dy}{dx}=3x+4y\)  at \(\displaystyle x=1\) with the initial condition \(\displaystyle y(0)=0\) and step size \(\displaystyle h=0.25\).

Possible Answers:

\(\displaystyle (1,0)\)

\(\displaystyle (1,2.0625)\)

\(\displaystyle (1,0.1875)\)

\(\displaystyle (1,0.75)\)

Correct answer:

\(\displaystyle (1,2.0625)\)

Explanation:

Euler's method uses iterative equations to find a numerical solution to a differential equation.  The following equations

\(\displaystyle x_{n+1}=x_n+h\)

\(\displaystyle y_{n+1}=y_n+h*f(x_n,y_n)\)

are solved starting at the initial condition and ending at the desired value.  \(\displaystyle f(x_n,y_n)\) is the solution to the differential equation.

In this problem,

\(\displaystyle f(x,y)=\frac{dy}{dx}=3x+4y\) 

\(\displaystyle h=0.25\)

Starting at the initial point \(\displaystyle (x_0,y_0)=(0,0)\)

 

\(\displaystyle x_{1}=x_0+h=0+0.25=0.25\)

\(\displaystyle y_{1}=y_0+h*f(x_0,y_0)=0+0.25*(3*0+4*0)=0\)

\(\displaystyle (x_1,y_1)=(0.25,0)\)

 

\(\displaystyle x_{2}=x_1+h=0.25+0.25=0.5\)

\(\displaystyle y_{2}=y_1+h*f(x_1,y_1)=0+0.25*(3*0.25+4*0)=0.1875\)

\(\displaystyle (x_2,y_2)=(0.5,0.1875)\)

 

We continue using Euler's method until \(\displaystyle x=1\).  The results of Euler's method are in the table below.

Screen shot 2015 11 19 at 3.48.44 pm

Note: Solving this differential equation analytically gives a different answer, \(\displaystyle 9.2997\).  Future problems will explain this discrepancy. 

Example Question #4 : Euler's Method

Use Euler's method to find the solution to the differential equation \(\displaystyle \frac{dy}{dx}=3x+4y\)  at \(\displaystyle x=1\) with the initial condition \(\displaystyle y(0)=0\) and step size \(\displaystyle h=0.1\).

Possible Answers:

\(\displaystyle (1,3.0114)\)

\(\displaystyle (1,4.4860)\)

\(\displaystyle (1,0.03)\)

\(\displaystyle (1,0)\)

Correct answer:

\(\displaystyle (1,4.4860)\)

Explanation:

Euler's method uses iterative equations to find a numerical solution to a differential equation.  The following equations

\(\displaystyle x_{n+1}=x_n+h\)

\(\displaystyle y_{n+1}=y_n+h*f(x_n,y_n)\)

are solved starting at the initial condition and ending at the desired value.  \(\displaystyle f(x_n,y_n)\) is the solution to the differential equation.

In this problem,

\(\displaystyle f(x,y)=\frac{dy}{dx}=3x+4y\) 

\(\displaystyle h=0.1\)

Starting at the initial point \(\displaystyle (x_0,y_0)=(0,0)\)

 

\(\displaystyle x_{1}=x_0+h=0+0.1=0.1\)

\(\displaystyle y_{1}=y_0+h*f(x_0,y_0)=0+0.1*(3*0+4*0)=0\)

\(\displaystyle (x_1,y_1)=(0.1,0)\)

 

\(\displaystyle x_{2}=x_1+h=0.1+0.1=0.2\)

\(\displaystyle y_{2}=y_1+h*f(x_1,y_1)=0+0.1*(3*0.1+4*0)=0.03\)

\(\displaystyle (x_2,y_2)=(0.2,0.03)\)

 

We continue using Euler's method until \(\displaystyle x=1\).  The results of Euler's method are in the table below.

Problem 2

Note: Solving this differential equation analytically gives a different answer, \(\displaystyle 9.2997\). As the step size gets larger, Euler's method gives a more accurate answer. 

Example Question #5 : Euler's Method

Use Euler's method to find the solution to the differential equation \(\displaystyle \frac{dy}{dx}=\frac{y}{x}\)  at \(\displaystyle x=2\) with the initial condition \(\displaystyle y(1)=1\) and step size \(\displaystyle h=0.25\).

Possible Answers:

\(\displaystyle (2,1)\)

\(\displaystyle (2,3)\)

\(\displaystyle (2,2)\)

\(\displaystyle (2,1.75)\)

Correct answer:

\(\displaystyle (2,2)\)

Explanation:

Euler's method uses iterative equations to find a numerical solution to a differential equation.  The following equations

\(\displaystyle x_{n+1}=x_n+h\)

\(\displaystyle y_{n+1}=y_n+h*f(x_n,y_n)\)

are solved starting at the initial condition and ending at the desired value.  \(\displaystyle f(x_n,y_n)\) is the solution to the differential equation.

In this problem,  

\(\displaystyle f(x,y)=\frac{dy}{dx}=\frac{y}{x}\) 

\(\displaystyle h=0.25\)

Starting at the initial point \(\displaystyle (x_0,y_0)=(1,1)\)

 

\(\displaystyle x_{1}=x_0+h=1+0.25=1.25\)

\(\displaystyle y_{1}=y_0+h*f(x_0,y_0)=1+0.25*(1/1)=1.25\)

\(\displaystyle (x_1,y_1)=(1.25,1.25)\)

 

\(\displaystyle x_{2}=x_1+h=1.25+0.25=1.5\)

\(\displaystyle y_{2}=y_1+h*f(x_1,y_1)=1.25+0.25*(1.25/1.25)=1.5\)

\(\displaystyle (x_2,y_2)=(1.5,1.5)\)

 

We continue using Euler's method until \(\displaystyle x=2\).  The results of Euler's method are in the table below.

Problem 3

Example Question #6 : Euler's Method

Use Euler's method to find the solution to the differential equation \(\displaystyle \frac{dy}{dx}=\frac{y}{x}\)  at \(\displaystyle x=2\) with the initial condition \(\displaystyle y(1)=1\) and step size \(\displaystyle h=0.1\).

Possible Answers:

\(\displaystyle (2,1)\)

\(\displaystyle (2,3)\)

\(\displaystyle (2,2)\)

\(\displaystyle (2,1.75)\)

Correct answer:

\(\displaystyle (2,2)\)

Explanation:

Euler's method uses iterative equations to find a numerical solution to a differential equation.  The following equations

\(\displaystyle x_{n+1}=x_n+h\)

\(\displaystyle y_{n+1}=y_n+h*f(x_n,y_n)\)

are solved starting at the initial condition and ending at the desired value.  \(\displaystyle f(x_n,y_n)\) is the solution to the differential equation.

In this problem,

\(\displaystyle f(x,y)=\frac{dy}{dx}=\frac{y}{x}\) 

\(\displaystyle h=0.1\)

Starting at the initial point \(\displaystyle (x_0,y_0)=(1,1)\)

 

\(\displaystyle x_{1}=x_0+h=1+0.1=1.1\)

\(\displaystyle y_{1}=y_0+h*f(x_0,y_0)=1+0.1*(1/1)=1.1\)

\(\displaystyle (x_1,y_1)=(1.1,1.1)\)

 

\(\displaystyle x_{2}=x_1+h=1.1+0.1=1.2\)

\(\displaystyle y_{2}=y_1+h*f(x_1,y_1)=1.1+0.1*(1.1/1.1)=1.2\)

\(\displaystyle (x_2,y_2)=(1.2,1.2)\)

 

We continue using Euler's method until \(\displaystyle x=2\).  The results of Euler's method are in the table below.

Problem 4

Note: Due to the simplicity of the differential equation, Euler's method finds the exact solution, even with a large step size,  Using a smaller step size is unnecessary and more time consuming.

Example Question #7 : Euler's Method

Use Euler's method to find the solution to the differential equation \(\displaystyle \frac{dy}{dx}=cos(x)\)  at \(\displaystyle x=\pi/2\) with the initial condition \(\displaystyle y(0)=0\) and step size \(\displaystyle h= \pi/10\).

Possible Answers:

\(\displaystyle (\pi/2,0.314)\)

\(\displaystyle (\pi/2,1.57)\)

\(\displaystyle (\pi/2,1.25)\)

\(\displaystyle (\pi/2,1.14)\)

Correct answer:

\(\displaystyle (\pi/2,1.14)\)

Explanation:

Euler's method uses iterative equations to find a numerical solution to a differential equation.  The following equations

\(\displaystyle x_{n+1}=x_n+h\)

\(\displaystyle y_{n+1}=y_n+h*f(x_n,y_n)\)

are solved starting at the initial condition and ending at the desired value.  \(\displaystyle f(x_n,y_n)\) is the solution to the differential equation.

In this problem,

\(\displaystyle f(x,y)=\frac{dy}{dx}=cos(x)\) 

\(\displaystyle h= \pi/10\)

Starting at the initial point \(\displaystyle (x_0,y_0)=(0,0)\)

 

\(\displaystyle x_{1}=x_0+h=0+\pi/10=\pi/10\)

\(\displaystyle y_{1}=y_0+h*f(x_0,y_0)=0+(\pi/10)*cos(0)=\pi/10\)

\(\displaystyle (x_1,y_1)=(\pi/10,\pi/10)\)

 

\(\displaystyle x_{2}=x_1+h=\pi/10+\pi/10=\pi/5\)

\(\displaystyle y_{2}=y_1+h*f(x_1,y_1)=\pi/10+(\pi/10)*cos(\pi/10)=\pi/5\)

\(\displaystyle (x_2,y_2)=(\pi/5,\pi/5)\)

 

We continue using Euler's method until \(\displaystyle x=\pi/2\).  The results of Euler's method are in the table below.

Problem 7

Example Question #1 : New Concepts

Use Euler's method to find the solution to the differential equation \(\displaystyle \frac{dy}{dx}=cos(x)\)  at \(\displaystyle x=\pi/2\) with the initial condition \(\displaystyle y(0)=0\) and step size \(\displaystyle h= \pi/20\).

Possible Answers:

\(\displaystyle (\pi/2,1.07)\)

\(\displaystyle (\pi/2,2)\)

\(\displaystyle (\pi/2,0.314)\)

\(\displaystyle (\pi/2,1.25)\)

Correct answer:

\(\displaystyle (\pi/2,1.07)\)

Explanation:

Euler's method uses iterative equations to find a numerical solution to a differential equation.  The following equations

\(\displaystyle x_{n+1}=x_n+h\)

\(\displaystyle y_{n+1}=y_n+h*f(x_n,y_n)\)

are solved starting at the initial condition and ending at the desired value.  \(\displaystyle f(x_n,y_n)\) is the solution to the differential equation.

In this problem,

\(\displaystyle f(x,y)=\frac{dy}{dx}=cos(x)\) 

\(\displaystyle h= \pi/20\)

Starting at the initial point \(\displaystyle (x_0,y_0)=(0,0)\)

 

\(\displaystyle x_{1}=x_0+h=0+\pi/20=\pi/20\)

\(\displaystyle y_{1}=y_0+h*f(x_0,y_0)=0+(\pi/20)*cos(0)=\pi/20\)

\(\displaystyle (x_1,y_1)=(\pi/20,\pi/20)\)

 

\(\displaystyle x_{2}=x_1+h=\pi/20+\pi/20=\pi/10\)

\(\displaystyle y_{2}=y_1+h*f(x_1,y_1)=\pi/20+(\pi/20)*cos(\pi/20)=\pi/10\)

\(\displaystyle (x_2,y_2)=(\pi/10,\pi/10)\)

 We continue using Euler's method until \(\displaystyle x=\pi/2\).  The results of Euler's method are in the table below.

Problem 8

Example Question #9 : Euler's Method

Use Euler's method to find the solution to the differential equation \(\displaystyle \frac{dy}{dx}=y^2e^{x}\)  at \(\displaystyle x=6\) with the initial condition \(\displaystyle y(0)=0.01\) and step size \(\displaystyle h= 1\).

Possible Answers:

\(\displaystyle (6,1.0157)\)

\(\displaystyle (6,0.0239)\)

\(\displaystyle (6,0.1089)\)

\(\displaystyle (6,0.1013)\)

Correct answer:

\(\displaystyle (6,0.1089)\)

Explanation:

Euler's method uses iterative equations to find a numerical solution to a differential equation.  The following equations

\(\displaystyle x_{n+1}=x_n+h\)

\(\displaystyle y_{n+1}=y_n+h*f(x_n,y_n)\)

are solved starting at the initial condition and ending at the desired value.  \(\displaystyle f(x_n,y_n)\) is the solution to the differential equation.

In this problem,

\(\displaystyle f(x,y)=\frac{dy}{dx}=y^2e^{x}\) 

\(\displaystyle h= 1\)

Starting at the initial point \(\displaystyle (x_0,y_0)=(0,0.01)\)

 

\(\displaystyle x_{1}=x_0+h=0+1=1\)

\(\displaystyle y_{1}=y_0+h*f(x_0,y_0)=0.01+1*(0.01)^2*e^{0}=0.0101\)

\(\displaystyle (x_1,y_1)=(1,0.0101)\)

 

\(\displaystyle x_{2}=x_1+h=1+1=2\)

\(\displaystyle y_{2}=y_1+h*f(x_1,y_1)=0.0101+1*(0.0101)*e^{1}=0.01038\)

\(\displaystyle (x_2,y_2)=(2,0.01038)\)

 

We continue using Euler's method until \(\displaystyle x=6\).  The results of Euler's method are in the table below.

Problem 11

Example Question #2 : Euler's Method

Use Euler's method to find the solution to the differential equation \(\displaystyle \frac{dy}{dx}=y^2e^{x}\)  at \(\displaystyle x=6\) with the initial condition \(\displaystyle y(0)=0.01\) and step size \(\displaystyle h= 0.5\).

Possible Answers:

\(\displaystyle (6,5.113)\)

\(\displaystyle (6,0.1089)\)

\(\displaystyle (6,0.012)\)

\(\displaystyle (6,0.013)\)

Correct answer:

\(\displaystyle (6,5.113)\)

Explanation:

Euler's method uses iterative equations to find a numerical solution to a differential equation.  The following equations

\(\displaystyle x_{n+1}=x_n+h\)

\(\displaystyle y_{n+1}=y_n+h*f(x_n,y_n)\)

are solved starting at the initial condition and ending at the desired value.  \(\displaystyle f(x_n,y_n)\) is the solution to the differential equation.

In this problem,

\(\displaystyle f(x,y)=\frac{dy}{dx}=y^2e^{x}\) 

\(\displaystyle h= 0.5\)

Starting at the initial point \(\displaystyle (x_0,y_0)=(0,0.01)\)

 

\(\displaystyle x_{1}=x_0+h=0+0.5=0.5\)

\(\displaystyle y_{1}=y_0+h*f(x_0,y_0)=0.01+0.5*(0.01)^2*e^{0}=0.01005\)

\(\displaystyle (x_1,y_1)=(0.5,0.01005)\)

 

\(\displaystyle x_{2}=x_1+h=0.5+0.5=1\)

\(\displaystyle y_{2}=y_1+h*f(x_1,y_1)=0.01005+0.5*(0.01005)*e^{1}=0.01013\)

\(\displaystyle (x_2,y_2)=(1,0.01013)\)

 

We continue using Euler's method until \(\displaystyle x=6\).  The results of Euler's method are in the table below.

Problem 12

Learning Tools by Varsity Tutors