Direction Fields and Numerical Methods

For the rest of this chapter we will focus on various methods for solving differential equations and analyzing the behavior of the solutions. In some cases it is possible to predict properties of a solution to a differential equation without knowing the actual solution. We will also study numerical methods for solving differential equations, which can be programmed by using various computer languages or even by using a spreadsheet program, such as Microsoft Excel.

Creating Direction Fields

Direction fields (also called slope fields) are useful for investigating first-order differential equations. In particular, we consider a first-order differential equation of the form

y=f(x,y).

An applied example of this type of differential equation appears in Newton’s law of cooling, which we will solve explicitly later in this chapter. First, though, let us create a direction field for the differential equation

T(t)=−0.4(T72).

Here T(t)

represents the temperature (in degrees Fahrenheit) of an object at time t,

and the ambient temperature is 72°F.

[link] shows the direction field for this equation.

A graph of a direction field for the given differential equation in quadrants one and two. The arrows are pointing directly to the right at y = 72. Below that line, the arrows have increasingly positive slope as y becomes smaller. Above that line, the arrows have increasingly negative slope as y becomes larger. The arrows point to convergence at y = 72. Two solutions are drawn: one for initial temperature less than 72, and one for initial temperatures larger than 72. The upper solution is a decreasing concave up curve, approaching y = 72 as t goes to infinity. The lower solution is an increasing concave down curve, approaching y = 72 as t goes to infinity.

The idea behind a direction field is the fact that the derivative of a function evaluated at a given point is the slope of the tangent line to the graph of that function at the same point. Other examples of differential equations for which we can create a direction field include

y=3x+2y4y=x2y2y=2x+4y2.

To create a direction field, we start with the first equation: y=3x+2y4.

We let (x0,y0)

be any ordered pair, and we substitute these numbers into the right-hand side of the differential equation. For example, if we choose x=1andy=2,

substituting into the right-hand side of the differential equation yields

y=3x+2y4=3(1)+2(2)4=3.

This tells us that if a solution to the differential equation y=3x+2y4

passes through the point (1,2),

then the slope of the solution at that point must equal 3.

To start creating the direction field, we put a short line segment at the point (1,2)

having slope 3.

We can do this for any point in the domain of the function f(x,y)=3x+2y4,

which consists of all ordered pairs (x,y)

in 2.

Therefore any point in the Cartesian plane has a slope associated with it, assuming that a solution to the differential equation passes through that point. The direction field for the differential equation y=3x+2y4

is shown in [link].

A graph of the direction field for the differential equation y’ = 3 x + 2 y – 4 in all four quadrants. In quadrants two and three, the arrows point down and slightly to the right. On a diagonal line, roughly y = -x + 2, the arrows point further and further to the right, curve, and then point up above that line.

We can generate a direction field of this type for any differential equation of the form y=f(x,y).

Definition

A direction field (slope field) is a mathematical object used to graphically represent solutions to a first-order differential equation. At each point in a direction field, a line segment appears whose slope is equal to the slope of a solution to the differential equation passing through that point.

Using Direction Fields

We can use a direction field to predict the behavior of solutions to a differential equation without knowing the actual solution. For example, the direction field in [link] serves as a guide to the behavior of solutions to the differential equation y=3x+2y4.

To use a direction field, we start by choosing any point in the field. The line segment at that point serves as a signpost telling us what direction to go from there. For example, if a solution to the differential equation passes through the point (0,1),

then the slope of the solution passing through that point is given by y=3(0)+2(1)4=−2.

Now let x

increase slightly, say to x=0.1.

Using the method of linear approximations gives a formula for the approximate value of y

for x=0.1.

In particular,

L(x)=y0+f(x0)(xx0)=12(x00)=12x0.

Substituting x0=0.1

into L(x)

gives an approximate y

value of 0.8.

At this point the slope of the solution changes (again according to the differential equation). We can keep progressing, recalculating the slope of the solution as we take small steps to the right, and watching the behavior of the solution. [link] shows a graph of the solution passing through the point (0,1).

A graph of the direction field for the differential equation y’ = 3 x + 2 y – 4 in all four quadrants. In quadrants two and three, the arrows point down and slightly to the right. On a diagonal line, roughly y = -x + 2, the arrows point further and further to the right, curve, and then point up above that line. The solution passing through the point (0, 1) is shown. It curves down through (-5, 10), (0, 2), (1, 0), and (3, -10).

The curve is the graph of the solution to the initial-value problem

y=3x+2y4,y(0)=1.

This curve is called a solution curve passing through the point (0,1).

The exact solution to this initial-value problem is

y=32x+5414e2x,

and the graph of this solution is identical to the curve in [link].

Create a direction field for the differential equation y=x2y2

and sketch a solution curve passing through the point (−1,2).


A graph of the direction field for the differential equation y’ = x ^ 2 – y ^ 2. Along y = x and y = -x, the lines are horizontal. On either side of y = x and y = -x, the lines slant and direct solutions along those two functions. The rest of the lines are vertical. The solution going through (-1, 2) is shown. It curves down from about (-2.75, 10), through (-1, 2) and about (0, 1.5), and then up along the diagonal to (10, 10).

Hint

Use x

and y

values ranging from −5

to 5.

For each coordinate pair, calculate y

using the right-hand side of the differential equation.

Go to this Java applet and this website to see more about slope fields.

Now consider the direction field for the differential equation y=(x3)(y24),

shown in [link]. This direction field has several interesting properties. First of all, at y=−2

and y=2,

horizontal dashes appear all the way across the graph. This means that if y=−2,

then y=0.

Substituting this expression into the right-hand side of the differential equation gives

(x3)(y24)=(x3)((−2)24)=(x3)(0)=0=y.

Therefore y=−2

is a solution to the differential equation. Similarly, y=2

is a solution to the differential equation. These are the only constant-valued solutions to the differential equation, as we can see from the following argument. Suppose y=k

is a constant solution to the differential equation. Then y=0.

Substituting this expression into the differential equation yields 0=(x3)(k24).

This equation must be true for all values of x,

so the second factor must equal zero. This result yields the equation k24=0.

The solutions to this equation are k=−2

and k=2,

which are the constant solutions already mentioned. These are called the equilibrium solutions to the differential equation.

A direction field for the given differential equation. The arrows are horizontal and pointing to the right at y = -4, y = 4, and x = 6. The closer the arrows are to x = 6, the more horizontal the arrows become. The further away, the more vertical they are. The arrows point down for y > 4 and x < 4, -4 < y < 4 and x > 6, and y < -4 and x < 6. In all other areas, the arrows are pointing up.

Definition

Consider the differential equation y=f(x,y).

An equilibrium solution is any solution to the differential equation of the form y=c,

where c

is a constant.

To determine the equilibrium solutions to the differential equation y=f(x,y),

set the right-hand side equal to zero. An equilibrium solution of the differential equation is any function of the form y=k

such that f(x,k)=0

for all values of x

in the domain of f.

An important characteristic of equilibrium solutions concerns whether or not they approach the line y=k

as an asymptote for large values of x.

Definition

Consider the differential equation y=f(x,y),

and assume that all solutions to this differential equation are defined for xx0.

Let y=k

be an equilibrium solution to the differential equation.

  1. y=k

    is an asymptotically stable solution to the differential equation if there exists

    ε>0

    such that for any value

    c(kε,k+ε)

    the solution to the initial-value problem


    y=f(x,y),y(x0)=c

    approaches

    k

    as

    x

    approaches infinity.

  2. y=k

    is an asymptotically unstable solution to the differential equation if there exists

    ε>0

    such that for any value

    c(kε,k+ε)

    the solution to the initial-value problem


    y=f(x,y),y(x0)=c

    never approaches

    k

    as

    x

    approaches infinity.

  3. y=k

    is an asymptotically semi-stable solution to the differential equation if it is neither asymptotically stable nor asymptotically unstable.

Now we return to the differential equation y=(x3)(y24),

with the initial condition y(0)=0.5.

The direction field for this initial-value problem, along with the corresponding solution, is shown in [link].

A direction field for the given differential equation. The arrows are horizontal and pointing to the right at y = -4, y = 4, and x = 6. The closer the arrows are to x = 6, the more horizontal the arrows become. The further away, the more vertical they are. The arrows point down for y > 4 and x < 4, -4 < y < 4 and x > 6, and y < -4 and x < 6. In all other areas, the arrows are pointing up. A solution is graphed that goes through (0, 0.5). It begins along y = -4 in quadrant three, increases from -4 to 4 between x = -1 and 1, and ends going along y = 4 in quadrant 1.

The values of the solution to this initial-value problem stay between y=−2

and y=2,

which are the equilibrium solutions to the differential equation. Furthermore, as x

approaches infinity, y

approaches 2.

The behavior of solutions is similar if the initial value is higher than 2,

for example, y(0)=2.3.

In this case, the solutions decrease and approach y=2

as x

approaches infinity. Therefore y=2

is an asymptotically stable solution to the differential equation.

What happens when the initial value is below y=−2?

This scenario is illustrated in [link], with the initial value y(0)=−3.

A direction field for the given differential equation. The arrows are horizontal and pointing to the right at y = -4, y = 4, and x = 6. The closer the arrows are to x = 6, the more horizontal the arrows become. The further away, the more vertical they are. The arrows point down for y > 4 and x < 4, -4 < y < 4 and x > 6, and y < -4 and x < 6. In all other areas, the arrows are pointing up. A solution is graphed that goes along y = -4 in quadrant 3 and curves between x = -1 and x = 0 to go to negative infinity along the y axis.

The solution decreases rapidly toward negative infinity as x

approaches infinity. Furthermore, if the initial value is slightly higher than −2,

then the solution approaches 2,

which is the other equilibrium solution. Therefore in neither case does the solution approach y=−2,

so y=−2

is called an asymptotically unstable, or unstable, equilibrium solution.

Stability of an Equilibrium Solution

Create a direction field for the differential equation y=(y3)2(y2+y2)

and identify any equilibrium solutions. Classify each of the equilibrium solutions as stable, unstable, or semi-stable.

The direction field is shown in [link].

A graph of a direction field with arrows pointing to the right at y = -4, y = 2, and y = 6. For y < -4, the arrows point up. For -4 < y < 2, the arrows point down. For 2 < y <6, the arrows point up, becoming flatter and flatter as they approach y = 6. For y > 6, the arrows point up and become more and more vertical the further they get from y = 6.

The equilibrium solutions are y=−2,y=1,

and y=3.

To classify each of the solutions, look at an arrow directly above or below each of these values. For example, at y=−2

the arrows directly below this solution point up, and the arrows directly above the solution point down. Therefore all initial conditions close to y=−2

approach y=−2,

and the solution is stable. For the solution y=1,

all initial conditions above and below y=1

are repelled (pushed away) from y=1,

so this solution is unstable. The solution y=3

is semi-stable, because for initial conditions slightly greater than 3,

the solution approaches infinity, and for initial conditions slightly less than 3,

the solution approaches y=3.

Analysis

It is possible to find the equilibrium solutions to the differential equation by setting the right-hand side equal to zero and solving for y.

This approach gives the same equilibrium solutions as those we saw in the direction field.

Create a direction field for the differential equation y=(x+5)(y+2)(y24y+4)

and identify any equilibrium solutions. Classify each of the equilibrium solutions as stable, unstable, or semi-stable.


A direction field with arrows pointing to the right at y = -4 and y = 4. The arrows point up for y > -4 and down for y < -4. Close to y = 4, the arrows are more horizontal, but the further away, the more vertical they become.


The equilibrium solutions are y=−2

and y=2.

For this equation, y=−2

is an unstable equilibrium solution, and y=2

is a semi-stable equilibrium solution.

Hint

First create the direction field and look for horizontal dashes that go all the way across. Then examine the slope lines directly above and below the equilibrium solutions.

Euler’s Method

Consider the initial-value problem

y=2x3,y(0)=3.

Integrating both sides of the differential equation gives y=x23x+C,

and solving for C

yields the particular solution y=x23x+3.

The solution for this initial-value problem appears as the parabola in [link].

A graph over the range [-1,4] for x and y. The given upward opening parabola is drawn with vertex at (1.5, 0.75). Individual points are plotted at (0, 3), (0.5, 1.5), (1, 0.5), (1.5, 0), (2, 0), (2.5, 0.5), and (3, 1.5) with line segments connecting them.

The red graph consists of line segments that approximate the solution to the initial-value problem. The graph starts at the same initial value of (0,3).

Then the slope of the solution at any point is determined by the right-hand side of the differential equation, and the length of the line segment is determined by increasing the x

value by 0.5

each time (the step size). This approach is the basis of Euler’s Method.

Before we state Euler’s Method as a theorem, let’s consider another initial-value problem:

y=x2y2,y(−1)=2.

The idea behind direction fields can also be applied to this problem to study the behavior of its solution. For example, at the point (−1,2),

the slope of the solution is given by y=(−1)222=−3,

so the slope of the tangent line to the solution at that point is also equal to −3.

Now we define x0=−1

and y0=2.

Since the slope of the solution at this point is equal to −3,

we can use the method of linear approximation to approximate y

near (−1,2).

L(x)=y0+f(x0)(xx0).

Here x0=−1,y0=2,

and f(x0)=−3,

so the linear approximation becomes

L(x)=23(x(−1))=23x3=−3x1.

Now we choose a step size. The step size is a small value, typically 0.1

or less, that serves as an increment for x;

it is represented by the variable h.

In our example, let h=0.1.

Incrementing x0

by h

gives our next x

value:

x1=x0+h=−1+0.1=−0.9.

We can substitute x1=−0.9

into the linear approximation to calculate y1.

y1=L(x1)=−3(−0.9)1=1.7.

Therefore the approximate y

value for the solution when x=−0.9

is y=1.7.

We can then repeat the process, using x1=−0.9

and y1=1.7

to calculate x2

and y2.

The new slope is given by y=(−0.9)2(1.7)2=−2.08.

First, x2=x1+h=−0.9+0.1=−0.8.

Using linear approximation gives

L(x)=y1+f(x1)(xx1)=1.72.08(x(−0.9))=1.72.08x1.872=−2.08x0.172.

Finally, we substitute x2=−0.8

into the linear approximation to calculate y2.

y2=L(x2)=−2.08x20.172=−2.08(−0.8)0.172=1.492.

Therefore the approximate value of the solution to the differential equation is y=1.492

when x=−0.8.

What we have just shown is the idea behind Euler’s Method. Repeating these steps gives a list of values for the solution. These values are shown in [link], rounded off to four decimal places.

Using Euler’s Method to Approximate Solutions to a Differential Equation
n 0 1 2 3 4 5
xn −1 −0.9 −0.8 −0.7 −0.6 −0.5
yn 2 1.7 1.492 1.3334 1.2046 1.0955
n 6 7 8 9 10
xn −0.4 −0.3 −0.2 −0.1 0
yn 1.0004 1.9164 1.8414 1.7746 1.7156
Euler’s Method

Consider the initial-value problem

y=f(x,y),y(x0)=y0.

To approximate a solution to this problem using Euler’s method, define

xn=x0+nhyn=yn1+hf(xn1,yn1).

Here h>0

represents the step size and n

is an integer, starting with 1.

The number of steps taken is counted by the variable n.

Typically h

is a small value, say 0.1

or 0.05.

The smaller the value of h,

the more calculations are needed. The higher the value of h,

the fewer calculations are needed. However, the tradeoff results in a lower degree of accuracy for larger step size, as illustrated in [link].

Two graphs of the same parabola, y = x ^ 2 – 3 x + 3. The first shows Euler’s method for the given initial-value problem with a step size of h = 0.05, and the second shows Euler’s method with a step size of h = 0.25. The first then has the points (0, 3), (.5, 1.5), (1, 0.5), (1.5, 0), (2, 0), (2.5, 0.5), and (3, 1.5) plotted with line segments connecting them. The second has the points (0, 3), (0.25, 2.25), (0.5, 1.625), (0.75, 1.125), (1, 0.75), (1.25, 0.5), (1.5, 0.375), (2, 0.5), (2.25, 0.75), (2.5, 1.125), (2.75, 1.625), and (3, 2.25) plotted with line segments connecting them.

Using Euler’s Method

Consider the initial-value problem

y=3x2y2+1,y(0)=2.

Use Euler’s method with a step size of 0.1

to generate a table of values for the solution for values of x

between 0

and 1.

We are given h=0.1

and f(x,y)=3x2y2+1.

Furthermore, the initial condition y(0)=2

gives x0=0

and y0=2.

Using [link] with n=0,

we can generate [link].

Using Euler’s Method to Approximate Solutions to a Differential Equation
n xn yn=yn1+hf(xn1,yn1)
0 0 2
1 0.1 y1=y0+hf(x0,y0)=1.7
2 0.2 y2=y1+hf(x1,y1)=1.514
3 0.3 y3=y2+hf(x2,y2)=1.3968
4 0.4 y4=y3+hf(x3,y3)=1.3287
5 0.5 y5=y4+hf(x4,y4)=1.3001
6 0.6 y6=y5+hf(x5,y5)=1.3061
7 0.7 y7=y6+hf(x6,y6)=1.3435
8 0.8 y8=y7+hf(x7,y7)=1.4100
9 0.9 y9=y8+hf(x8,y8)=1.5032
10 1.0 y10=y9+hf(x9,y9)=1.6202

With ten calculations, we are able to approximate the values of the solution to the initial-value problem for values of x

between 0

and 1.

For more information on Euler's method use this applet.

Consider the initial-value problem

y=x3+y2,y(1)=−2.

Using a step size of 0.1,

generate a table with approximate values for the solution to the initial-value problem for values of x

between 1

and 2.

n
xn
yn=yn1+hf(xn1,yn1)
   
{: valign=”top”} ———-
0  
1
−2
   
{: valign=”top”} 1
1.1
y1=y0+hf(x0,y0)=−1.5
   
{: valign=”top”} 2
1.2
y2=y1+hf(x1,y1)=−1.1419
   
{: valign=”top”} 3
1.3
y3=y2+hf(x2,y2)=−0.8387
   
{: valign=”top”} 4
1.4
y4=y3+hf(x3,y3)=−0.5487
   
{: valign=”top”} 5
1.5
y5=y4+hf(x4,y4)=−0.2442
   
{: valign=”top”} 6
1.6
y6=y5+hf(x5,y5)=0.0993
   
{: valign=”top”} 7
1.7
y7=y6+hf(x6,y6)=0.5099
   
{: valign=”top”} 8
1.8
y8=y7+hf(x7,y7)=1.0272
   
{: valign=”top”} 9
1.9
y9=y8+hf(x8,y8)=1.7159
   
{: valign=”top”} 10
2
y10=y9+hf(x9,y9)=2.6962

| {: valign=”top”}{: .unnumbered summary=”A table with three columns and eleven rows. The first column has the header n and the values 0 through 10. The second column has the header x_n and the values 1 through 2, increasing by 0.1. The third column has the header y_n = y_(n - 1) + hf(x_(n - 1), y_(n - 1)) and the values -2, -1.5, -1.1419, -0.8387, -0.5487, -0.2442, 0.0993, 0.5099, 1.0272, 1.7159, and 2.6962.” data-label=””}

Hint

Start by identifying the value of h,

then figure out what f(x,y)

is. Then use the formula for Euler’s Method to calculate y1,y2,

and so on.

Visit this website for a practical application of the material in this section.

Key Concepts

Key Equations

For the following problems, use the direction field below from the differential equation y=−2y.

Sketch the graph of the solution for the given initial conditions.* * *

A direction field with horizontal arrows pointing to the right at 0. The arrows above the x axis point down and to the right. The further away from the x axis, the steeper the arrows are, and the closer to the x axis, the flatter the arrows are. Likewise, the arrows below the x axis point up and to the right. The further away from the x axis, the steeper the arrows are, and the closer to the x axis, the flatter the arrows are.

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

A graph of the given direction field with a flat line drawn on the axis. The arrows point up for y < 0 and down for y > 0. The closer they are to the x axis, the more horizontal the arrows are, and the further away they are, the more vertical they become.

y(0)=−1

Are there any equilibria? What are their stabilities?

y=0

is a stable equilibrium

For the following problems, use the direction field below from the differential equation y=y22y.

Sketch the graph of the solution for the given initial conditions.* * *

A direction field with horizontal arrows at y = 0 and y = 2. The arrows point up for y > 2 and for y < 0. The arrows point down for 0 < y < 2. The closer the arrows are to these lines, the more horizontal they are, and the further away, the more vertical the arrows are.

y(0)=3
y(0)=1

A direction field with horizontal arrows at y = 0 and y = 2. The arrows point up for y > 2 and for y < 0. The arrows point down for 0 < y < 2. The closer the arrows are to these lines, the more horizontal they are, and the further away, the more vertical the arrows are. A solution is sketched that follows y = 2 in quadrant two, goes through (0, 1), and then follows the x axis.

y(0)=−1

Are there any equilibria? What are their stabilities?

y=0

is a stable equilibrium and y=2

is unstable

Draw the direction field for the following differential equations, then solve the differential equation. Draw your solution on top of the direction field. Does your solution follow along the arrows on your direction field?

y=t3
y=et

A direction field over the four quadrants. As t goes from 0 to infinity, the arrows become more and more vertical after being horizontal closer to x = 0.

dydx=x2cosx
dydt=tet

A direction field over [-2, 2] in the x and y axes. The arrows point slightly down and to the right over [-2, 0] and gradually become vertical over [0, 2].

dxdt=cosh(t)

Draw the directional field for the following differential equations. What can you say about the behavior of the solution? Are there equilibria? What stability do these equilibria have?

y=y21

A direction field with horizontal arrows pointing to the right at y = 1 and y = -1. The arrows point up for y < -1 and y > 1. The arrows point down for -1 < y < 1. The closer the arrows are to these lines, the more horizontal they are, and the further away they are, the more vertical they are.

y=yx
y=1y2x2

A direction field with arrows pointing down and to the right for nearly all points in [-2, 2] on the x and y axes. Close to the origin, the arrows become more horizontal, point to the upper right, become more horizontal, and then point down to the right again.

y=t2siny
y=3y+xy

A direction field with horizontal arrows pointing to the right on the x axis and x = -3. Above the x axis and for x < -3, the arrows point down. For x > -3, the arrows point up. Below the x axis and for x < -3, the arrows point up. For x > -3, the arrows point down. The further away from the x axis and x = -3, the arrows become more vertical, and the closer they become, the more horizontal they become.

Match the direction field with the given differential equations. Explain your selections.* * *

A direction field with arrows pointing down and to the right in quadrants two and three. After crossing the y axis, the arrows change direction and point up to the right.


A direction field with horizontal arrows pointing to the left in quadrants two and three. In crossing the y axis, the arrows switch and point upward in quadrants one and four.


A direction field with horizontal arrows pointing to the right on the x axis. Above, the arrows point down and to the right, and below, the arrows point up and to the right. The further from the x axis, the more vertical the arrows become.


A direction field with horizontal arrows on the x and y axes. The arrows point down and to the right in quadrants one and three. They point up and to the right in quadrants two and four.


A direction field with arrows pointing up in quadrants two and three, to the right on the y axis, and down in quadrants one and four.

y=−3y
y=−3t

E

y=et
y=12y+t

A

y=ty

Match the direction field with the given differential equations. Explain your selections.* * *

A direction field with horizontal arrows pointing to the right on the x and y axes. In quadrants one and three, the arrows point up, and in quadrants two and four, they point down.


A direction field with horizontal arrows pointing to the right on the x and y axes. In quadrants one and three, the arrows point up and to the right, and in quadrants two and four, the arrows point down and to the right.


A direction field with horizontal arrows pointing to the right on the x and y axes. In quadrants two and three, the arrows point down, and in quadrants one and four, the arrows point up.


A direction field with horizontal arrows pointing to the right on the x axis. The arrows point up and to the right in all quadrants. The closer the arrows are to the x axis, the more horizontal the arrows are, and the further away they are, the more vertical they are.


A direction field with horizontal arrows on the y axis. The arrows are also more horizontal closer to y = 1.5, y = -1.5, and the y axis. For y > 1.5 and x < 0, for y < -1.5 and x < 0, and for -1.5 < y < 1.5 and x > 0-, the arrows point down. For y> 1.5 and x > 0, for y < -1.5, for y < -1.5 and x > 0, and for -1.5 < y < 1.5 and x < 0, the arrows point up.

y=tsiny

B

y=tcosy
y=ttany

A

y=sin2y
y=y2t3

C

Estimate the following solutions using Euler’s method with n=5

steps over the interval t=[0,1].

If you are able to solve the initial-value problem exactly, compare your solution with the exact solution. If you are unable to solve the initial-value problem, the exact solution will be provided for you to compare with Euler’s method. How accurate is Euler’s method?

y=−3y,y(0)=1
y=t2
2.24,

exact: 3

y=3ty,y(0)=1.

Exact solution is y=3t+4et3

y=y+t2,y(0)=3.

Exact solution is y=5et2t22t

7.739364,

exact: 5(e1)

y=2t,y(0)=0

[T] y=e(x+y),y(0)=−1.

Exact solution is y=ln(e+1ex)

−0.2535

exact: 0

y=y2ln(x+1),y(0)=1.

Exact solution is y=1(x+1)(ln(x+1)1)

y=2x,y(0)=0,

Exact solution is y=2x1ln(2)

1.345,

exact: 1ln(2)

y=y,y(0)=−1.

Exact solution is y=ex.

y=−5t,y(0)=−2.

Exact solution is y=52t22

−4,

exact: 1/2

Differential equations can be used to model disease epidemics. In the next set of problems, we examine the change of size of two sub-populations of people living in a city: individuals who are infected and individuals who are susceptible to infection. S

represents the size of the susceptible population, and I

represents the size of the infected population. We assume that if a susceptible person interacts with an infected person, there is a probability c

that the susceptible person will become infected. Each infected person recovers from the infection at a rate r

and becomes susceptible again. We consider the case of influenza, where we assume that no one dies from the disease, so we assume that the total population size of the two sub-populations is a constant number, N.

The differential equations that model these population sizes are

S=rIcSIandI=cSIrI.

Here c

represents the contact rate and r

is the recovery rate.

Show that, by our assumption that the total population size is constant (S+I=N),

you can reduce the system to a single differential equation in I:I=c(NI)IrI.

Assuming the parameters are c=0.5,N=5,

and r=0.5,

draw the resulting directional field.


A direction field with horizontal arrows pointing to the right on the x axis and at y = 4. The arrows below the x axis and above y = 4 point down and to the right. The arrows between the x axis and y = 4 point up and to the right.

[T] Use computational software or a calculator to compute the solution to the initial-value problem y=ty,y(0)=2

using Euler’s Method with the given step size h.

Find the solution at t=1.

For a hint, here is “pseudo-code” for how to write a computer program to perform Euler’s Method for y=f(t,y),y(0)=2:

Create function f(t,y)

Define parameters y(1)=y0,t(0)=0,

step size h,

and total number of steps, N

Write a for loop:

for k=1to N

fn=f(t(k),y(k)) y(k+1)=y(k)+h*fn t(k+1)=t(k)+h

Solve the initial-value problem for the exact solution.

y=2et2/2

Draw the directional field

h=1
2

[T] h=10

[T] h=100

3.2756

[T] h=1000

[T] Evaluate the exact solution at t=1.

Make a table of errors for the relative error between the Euler’s method solution and the exact solution. How much does the error change? Can you explain?

2e
Step Size Error
{: valign=”top”} ———-
h=1  
0.3935
   
{: valign=”top”} h=10
0.06163
   
{: valign=”top”} h=100
0.006612
   
{: valign=”top”} h=1000
0.0006661

| {: valign=”top”}{: .unnumbered summary=”A table with two columns and five rows. The first column contains the label “Step Size” and the values h = 1, h=10, h=100, and h=1000. The second column contains the label “Error” and the values 0.3935, 0.06163, 0.006612, and 0.0006661.” data-label=””}

Consider the initial-value problem y=−2y,y(0)=2.

Show that y=2e−2x

solves this initial-value problem.

Draw the directional field of this differential equation.


A direction field with horizontal arrows pointing to the right on the x axis. Above the x axis, the arrows point down and to the right. Below the x axis, the arrows point up and to the right. The closer the arrows are to the x axis, the more horizontal the arrows are, and the further away they are from the x axis, the more vertical the arrows are.

[T] By hand or by calculator or computer, approximate the solution using Euler’s Method at t=10

using h=5.

[T] By calculator or computer, approximate the solution using Euler’s Method at t=10

using h=100.

4.0741e−10

[T] Plot exact answer and each Euler approximation (for h=5

and h=100)

at each h

on the directional field. What do you notice?

Glossary

asymptotically semi-stable solution
y=k

if it is neither asymptotically stable nor asymptotically unstable

asymptotically stable solution
y=k

if there exists

ε>0

such that for any value

c(kε,k+ε)

the solution to the initial-value problem

y=f(x,y),y(x0)=c

approaches

k

as

x

approaches infinity

asymptotically unstable solution
y=k

if there exists

ε>0

such that for any value

c(kε,k+ε)

the solution to the initial-value problem

y=f(x,y),y(x0)=c

never approaches

k

as

x

approaches infinity

direction field (slope field)
a mathematical object used to graphically represent solutions to a first-order differential equation; at each point in a direction field, a line segment appears whose slope is equal to the slope of a solution to the differential equation passing through that point
equilibrium solution
any solution to the differential equation of the form y=c,

where

c

is a constant

Euler’s Method
a numerical technique used to approximate solutions to an initial-value problem
solution curve
a curve graphed in a direction field that corresponds to the solution to the initial-value problem passing through a given point in the direction field
step size
the increment h

that is added to the

x

value at each step in Euler’s Method


Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.

You can also download for free at http://cnx.org/contents/9a1df55a-b167-4736-b5ad-15d996704270@5.1

Attribution: