# Math 1170-002, Math 1170-003 Spring 2007 A. McDonald Laboratory 3 Exercises ```Math 1170-002, Math 1170-003
Spring 2007
A. McDonald
Laboratory 3 Exercises
Directions: Open a new xterm window and make sure you are in the Math1170 directory. Open
M aple by using the xmaple &amp; command. Save the worksheet as laboratoryexercises3.mws. Complete the following exercises, saving your work periodically. When you have completed the exercises,
print out a copy of your worksheet to submit with your laboratory report. Laboratory reports will be
due by class time on February 12, 2007.
Sequences play an important role in the mathematical modeling of population dynamics. When
sequences are used in this manner, the general behavior of the sequence becomes an important quality
that we would like to characterize. In this laboratory we will explore sequences, their mathematical
representations, and their qualitative behavior.
A sequence is a particular ordering of objects that is indexed by the natural numbers (N) or the
non-negative integers (Z+ + {0}). Let n be any non-negative integer and an denote the nth term of
the sequence (see below).
a0 , a1 , a2 , . . . , an−1 , an , an+1 , . . .
Consider the sequence of positive even integers 2,4,6,8,10, . . . . For this sequence a0 = 2, a1 = 4, a2 = 6,
and so on. As you could imagine, writing out all terms of sequence would be exhausting. Thankfully,
there are two ways to define a sequence formally that do not require writing all terms of the sequence
explicitly. In this laboratory we will explore one of these two representations.
A recursion relation defines the process one must go through to get from any term of the sequence,
say an , to the next one, an+1 . This process may depend on any or all of the previous sequence terms
(a1 , a2 , . . . , an ) as well as the index variable n. In the language of mathematics, recursion relations
take on the form
an+1 = f (an , an−1 , . . . , a1 , n)
where f is a function that defines the updating process. The function f is sometimes called an updating function as it uses known terms of the sequence to produce new terms of the sequence. For
simplicity, we will focus our energies on recursion relations of the form an+1 = f (an ) today. Recursion
relations alone cannot be used to represent a sequence. You must also provide additional information.
An initial condition is any information that must be specified so that a recursion relation can be
used to fully represent a sequence of interest.
Let’s study an example to solidify your understanding of the concept and language. Consider the
recursion relation an+1 = an + 2 and the initial condition a0 = 2. This relation takes the general form
an+1 = f (an ) where the updating function is f (an ) = an + 2. The table below shows the first five
terms of the sequence generated by an+1 = an + 2 when coupled with a0 = 2.
Sequence Term
an
a0
a1
a2
a3
a3
..
.
Sequence Value
an+1 = an + 2
2 (given)
a0 + 2 = 2 + 2 = 4
a1 + 2 = 4 + 2 = 6
a2 + 2 = 6 + 2 = 8
a3 + 2 = 8 + 2 = 10
..
.
The recursion relation an+1 = an + 2 when coupled with the initial condition a0 = 2 generates the
sequence of positive even integers 2, 4, 6, 8, 10, . . . .
What happens if we prescribe a different initial condition to the recursion relation an+1 = an + 2?
Say we set a0 = 1. The recursion relation an+1 = an + 2 when coupled with the new initial condition
a0 = 1 generates a new sequence. What is it?
Sequence Term
an
a0
a1
a2
a3
a4
..
.
Sequence Value
an+1 = an + 2
1 (given)
a0 + 2 =
a1 + 2 =
a2 + 2 =
a3 + 2 =
..
.
When given a recursion relation and an initial condition, it is not very difficult to determine the
terms of the sequence as it just involves performing some basic computations. A slightly different
(and perhaps more difficult) problem is to find a recursion relation that represents a known sequence.
Finding an appropriate recursion relation boils down to finding the right updating function f . Recall
that f defines the mathematical process one must go through to get from one term of the sequence
to the next. This process (or rule) must be ubiquitous for the sequence. That is to say, the rule must
apply to any two consecutive sequence terms (see illustration below).
'\$
'\$
f (an )
an
-
&amp;%
an+1
&amp;%
1
, . . . . Our goal is
An example may help in your understanding. Consider the sequence 1, 12 , 14 , 81 , 16
to find a recursion relation of the form an+1 = f (an ) that when coupled with a0 = 1 generates this
sequence.
'\$
a0
f (a0 ) -
&amp;%
'\$
a1
f (a1 ) -
&amp;%
'\$
a2
f (a2 ) -
&amp;%
'\$
a3
&amp;%
'\$
1
f (1)
&amp;%
'\$
1
2
-
f ( 12 )
'\$
1
4
-
&amp;%
f ( 14 )
&amp;%
'\$
-
1
8
&amp;%
Use the illustration above to find the updating pattern and use this pattern to write a functional form
for the updating function f . Next write the recursion relation that represents this sequence.
f (an ) =
an+1 = f (an ) =
Hopefully you came to the conclusion that f (an ) = 21 an for this sequence resulting in the recursion
relation an+1 = 21 an . The table below confirms this solution is correct.
Sequence Term
an
a0
a1
a2
a3
a4
..
.
Sequence Value
an+1 = 12 an
1 (given)
1
a
= 12 ∗ 1 = 12
0
2
1
1
1
1
2 a1 = 2 ∗ 2 = 4
1
1
1
1
2 a2 = 2 ∗ 4 = 8
1
1
1
1
2 a3 = 2 ∗ 8 = 16
..
.
You may be wondering why sequences and recursion relations are useful for scientists. Recursion
relations are often used in the sciences as representations of sequences. Here, the sequence term an
is usually taken to be the number of individuals within a population at some ”time step” n and a
recursion relation is constructed to model how this population is thought to change between successive
time steps. It is this dynamical property that makes recursion relations appealing to modelers. When
sequences and recursion relations are used in this context, they are often referred to as discrete time
dynamical models. Discrete time dynamical models show up in biology are often used in modeling
plant and insect populations.
Whatever the application may be, the purpose of constructing a model is to somehow use it to
predict future states of the population. The model may be able to predict population extinctions or
massive population expansions. In general, there are two ways to make these assessments: (1) use
the model to generate sequence terms from which we can observe the general sequence trend(s) or (2)
use a graphical method called cobwebbing (see additional handout) to tease out qualitative behavior
without explicitly computing the sequence terms.
So how do you generate sequence terms given some discrete time dynamical model and initial condition
using M aple? The trick is to write a short program that tells Maple to compute the terms of the
sequence using the model. As with most concepts, it is easiest to understand the algorithm details
in the context of a problem. Let’s consider again the model an+1 = an + 2 with the initial condition
a0 = 2. To compute ten additional terms of the sequence (i.e. a1 through a11 ), use the following
algorithm:
[&gt; a:=2;
N:=10:
for n from 0 by 1 to N do
a[n+1]:=a[n]+2;
end do;
Notice that all lines of the program must be entered simultaneously. By pressing ”shift” and ”enter” together, you return to the next line on the worksheet without entering your command. Use this
trick to write all five lines before entering your work. If you entered the program correctly, M aple
should output values for sequence terms a0 through a11 . The sequence generated by this model and
initial condition is the sequence of positive even integers.
You can easily change the initial condition, model, or number of terms generated by the program
easily. To change the initial condition, change the value a0 takes on in the algorithm (choose any real
number for a0 ). To change the number of sequence terms Maple outputs, change the value N takes on
in the algorithm (choose any integer N &gt; 0). Lastly, to change the model, edit the recursion relation
presented in the command line a[n+1]:=a[n]+2;.
1. Starting with the initial condition a0 = 8, use a modified version of the provided algorithm to
generate the next ten terms of the sequence modeled by an+1 = 12 ∗ an . Input your results in the
table below.
Sequence Term
an
a0
a1
a2
a3
a4
a5
a6
a7
a8
a9
a10
Sequence Value
an+1 = 12 an
8 (given)
2. Create a plot of the sequence generated in Exercise 1. Use this plot to characterize the general
behavior of the sequence. Do you think you can predict what would happens to sequence values
for large n (i.e. the long-term trends)?
Hint: Treat the table you created like data and use the command lines shown below. Together, the lines should generate a plot of the sequence in which the x-axis represents the term
and the y-axis represents the sequence value. Make sure you provide labels on your plot.
[&gt;
[&gt;
[&gt;
[&gt;
modelterm:=[seq(n,n=0..N+1)];
modelvalues:=[seq(a[n],n=0..N+1)];
modeldata:=[seq([modelterm[n],modelvalues[n]],n=1..N+2)];
plot(modeldata,style=[point]);
3. Use Figure 1 to provide a cobwebbing diagram for the model an+1 =
1
2
∗ an starting with the
initial condition a0 = 8. Use your cobwebbing diagram to sketch the general behavior of the
resulting sequence.
4. Starting with the initial condition a0 = 8, use a modified version of the provided algorithm to
generate the next ten terms of the sequence modeled by an+1 = 1 ∗ an . Input your results in the
table below.
Sequence Term
an
a0
a1
a2
a3
a4
a5
a6
a7
a8
a9
a10
Sequence Value
an+1 = an
8 (given)
5. Create a plot of the sequence generated in Exercise 4. Use this plot to characterize the general
behavior of the sequence. Do you think you can predict what would happens to sequence values
for large n (i.e. the long-term trends)?
6. Use Figure 2 to provide a cobwebbing diagram for the model an+1 = 1 ∗ an starting with the
initial condition a0 = 8. Use your cobwebbing diagram to sketch the general behavior of the
resulting sequence.
7. Starting with the initial condition a0 = 8, use a modified version of the provided algorithm to
generate the next ten terms of the sequence modeled by an+1 = 2 ∗ an . Input your results in the
table below.
Sequence Term
an
a0
a1
a2
a3
a4
a5
a6
a7
a8
a9
a10
Sequence Value
an+1 = 2an
8 (given)
8. Create a plot of the sequence generated in Exercise 7. Use this plot to characterize the general
behavior of the sequence. Do you think you can predict what would happens to sequence values
for large n (i.e. the long-term trends)?
9. Use Figure 3 to provide a cobwebbing diagram for the model an+1 = 2 ∗ an starting with the
initial condition a0 = 8. Use your cobwebbing diagram to sketch the general behavior of the
resulting sequence.
10. In this laboratory you studied three models that have very similar updating functions; namely,
each model has an updating function of the form f (an ) = r ∗ an where r is some constant. With
any luck, you successfully observed that each model generated sequences with distinctly different
behaviors. Run the algorithm for additional (and different) non-negative values of r to see if you
can determine how value of r influences the behavior of the sequences generated.
Figure 1:
a[n+1]
0
5
10
15
20
5
a[n]
10
Cobwebbing Diagram
15
20
Figure 2:
a[n+1]
0
5
10
15
20
5
a[n]
10
Cobwebbing Diagram
15
20
Figure 3:
a[n+1]
0
10
20
30
40
5
a[n]
10
Cobwebbing Diagram
15
20
```