Direction Fields

dirfield.mws

Douglas B. Meade (meade@math.sc.edu)

1 Overview

A direction field is a simple, pictorial, tool for understanding how solutions to a differential equation behave, without computing the solution. Direction fields are particularly useful when you first look at a differential equation. Direction fields can be useful when checking if a solution to a differential equation is correct. The fundamental idea is that tangent lines to the solution must be parallel to the arrows in the direction field. (This works both for symbolic solutions and for numeric solutions.)

2 Objectives

• understand the graphical information conveyed by a differential equation

• begin to understand the concept of a solution to a differential equation

• illustrate the use of Maple’s DEplot command

3 New Maple Commands

• DEplot produces a plot of a direction field for an ODE

4 Introduction

The DEplot command, in the DEtools package, can be used to produce different types of plots for solutions of differential equations.

   > restart;
   > with( plots ):
   > with( DEtools ):

Our most common use will be to create a plot of the direction field for an ODE. To illustrate, let’s create a direction field for the differential equation y’( x) = x^{2} − y(x). The first step is to enter the ODE:

> ODE := diff( y(x), x ) = x^2 - y(x);

ODE := \frac{∂}{∂x} y(x) = x^{2} − y(x)

The DEplot command needs to know the differential equation(s), the dependent variable(s), and ranges for the independent and dependent variables.

> DEplot( ODE, y, x=-1..3, y=-5..7, title=`y' = x^2 - y` );

The title is optional, but highly recommended. Other optional arguments will be introduced in this worksheet and others in this supplement; see ?DEplot for a complete list of optional arguments.

4.1 Points to Ponder

• What do you see in this plot?

• What do the arrows indicate?

• How would a stick float down a stream with these flow patterns?

• Does this depend upon where the stick enters the flow?

One way to approach the fourth question is to use DEplot with slightly different arguments:

> IC := { [0,-2], [0,-1], [0,0], [0,1], [0,2] };

IC := {[0, −2], [0, −1], [0, 0], [0, 1], [0, 2]}

> DEplot( ODE, y, x=-1..3, IC, title=`y' = x^2 - y` );

Notice that the only change is the replacement of the range for the dependent variable ( y) with a set of five points. Notice that each of the five curves in the plot passes through a different point in this set.

• What additional information does this picture provide?

• Do you need to reconsider any of your answers to the previous questions?

• Can you now add more detail to your answers?

Consider the equation y’( x) = −\frac{y(x)}{x} :

> ODE := diff( y(x), x ) = -y(x)/x;

ODE := \frac{∂}{∂x} y(x) = −\frac{y(x)}{x}

Does this differential equation satisfy the continuity conditions necessary to apply the Existence and Uniqueness Theorem (Section 1.2)? Explain.

> DEplot( ODE, y, x=-1..1, y=-1..1, title=`y' = -y/x` );

4.2 More Points to Ponder

What indications of a problem with the existence can be seen in the direction field?

It might help to zoom in on a special part of this plot?

5 Example 1 (p. 19)

A logistic equation for a population with size p (in thousands) at time t is

> ODE := diff( p(t), t ) = p(t) * ( 2 - p(t) );

ODE := \frac{∂}{∂t} p(t) = p(t) (2 − p(t))

Use a direction field to answer the following questions:

• If the initial population is 3000 (that is, p(0) = 3), what can you say about the limiting population lim_{t→∞} p(t)?

• Can a population of 1000 ever decline to 500? (vice versa?)

• Can a population of 1000 ever increase to 3000? (vice versa?)

5.1 Solution

For this problem it seems most natural to create a direction field with two solution curves – one passing through the point (0,3) and one passing through (0,1).

> DEplot( ODE, p, t=0..5, { [0,3], [0,1] }, title = `p' = p ( 2
- p )` );

From this picture it is now clear that when the initial population is 3000, the population decreases to 2000 as time increases towards infinity (i.e., lim_{t→∞} p(t) = 2).

Also, when the initial population is 1000, the population increases, so there will be no time when this population has size 500. While the population increases, it never reaches 3000 (in fact, it never exceeds 2000). Note that the same conclusions hold independent of the time at which the population has size 1000.

6 Copyright

dirfield.mws – a Maple worksheet for direction fields (for use with section 1.3 of Nagle and Saff) Prepared by: Douglas B. Meade (7 March 1996) as part of the Maple Supplement for Nagle/Saff (Addison-Wesley) Updated to Maple V, Release 4, by Douglas B. Meade (27 December, 1996) For more information, please contact the author at one of following addresses: Department of Mathematics, Univ. of South Carolina, Columbia, SC 29208 (803) 777-6183 meade@math.sc.edu (copyright, Douglas B. Meade, 1996)