Sequences 215 problem 01.mws

1. Sequences with Maple.

In Maple, a sequence is distinguished from a set by using square brackets instead of curly braces to list the elements. Thus S := [1, 2, 2, 3] defines a sequence which has four terms, but S := {1, 2, 2, 3} is a set which contains only the 3 elements 1, 2 and 3. A sequence can be given by listing the elements as above, in which case,

to get the third term, we would type in S[3] and we would get 2 for the answer. Note that if we define S as a set, then S[3] will not give the same answer. Try some examples to get a better sense of what is going on.

To generate sequences in mathematics, it is convenient if we can just give a rule for how to compute the n'th term (this really makes sense since a sequence is simply a function whose domain is the Natural numbers). Maple allows us to do the same, using the command seq . For example to obtain the first eighteen terms of the sequence {sqrt(n-3), 3 <= n} , we could type in

> seq(sqrt(n-3),n=3..20);

0, 1, sqrt(2), sqrt(3), 2, sqrt(5), sqrt(6), sqrt(7...

Notice that the result is not given in square braces, so in order to make a sequence in the mathematical sense from this output, we have to enclose the result in square brackets like the following:

> S:=[seq(sqrt(n-3),n=3..20)];

S := [0, 1, sqrt(2), sqrt(3), 2, sqrt(5), sqrt(6), ...

Now we can retrieve the fourth element by just typing in

> S[4];

sqrt(3)

Strictly speaking, Maple calls the output of the seq command a sequence, and a sequence enclosed in square braces is called a list. But we will call such lists sequences as well. Also, the seq command cannot be used to create infinite sequences.

We can plot a sequence on a vertical axis (the traditional range axis for a function) by plotting a sequence of ordered pairs whose x -coordinate is zero.

Error, missing operator or `;`

> T:=[seq([0,S[n]],n=1..18)];

T := [[0, 0], [0, 1], [0, sqrt(2)], [0, sqrt(3)], [...
T := [[0, 0], [0, 1], [0, sqrt(2)], [0, sqrt(3)], [...

> plot(T,-.1..0.1,style=point,symbol=circle,scaling=constrained);

(You may have to grab the graph with your mouse and stretch it to make it look right).

[Maple Plot]

Again, since a sequence is a function we may want to graph the ordered pairs (n,s(n)), so this time, we make the

x -coordinate n , and the y -coordinate S[ n ].

> T:=[seq([n,S[n]],n=1..18)];plot(T,style=point,symbol=diamond);

T := [[1, 0], [2, 1], [3, sqrt(2)], [4, sqrt(3)], [...
T := [[1, 0], [2, 1], [3, sqrt(2)], [4, sqrt(3)], [...

[Maple Plot]

To get Maple to evaluate the limit of a sequence, you must enter the rule determining the terms in the limit command.

For example:

> limit(sqrt(n-3),n=infinity);

Error, (in limit) invalid limiting point

Submission:

Use Maple to create a list of the first 20 terms of the sequence {4*sqrt(n)} . Then make pictures as above.

Finally, estimate the limit of the sequence from the picture, and then find the actual limit using the limit command.

Submission worksheet:

>

2. Using Maple to investigate the formal definition of the limit of a sequence.

Recall the formal definition of the limit of a sequence. It looks alot like the definition of the limit of a function, so it should be easy to remember.

limit(a[n],n = infinity) = L if for every epsilon where 0 < epsilon there is an N such that N <= n implies abs(a[n]-L) < epsilon

Consider the sequence {n/(n+1)} , we first create a graph of enough terms to guess the limit, and then we make a graph illustrating the N corresponding to epsilon = .1 .

> plot([seq([n,n/(n+1)],n=1..50)],style=point);

[Maple Plot]

The graph shows that L = 1 is a good guess for the limit. Now to find the N corresponding to

epsilon = .1 , try various starting values for n in the plot above.

> plot([seq([n,n/(n+1)],n=2..100)],style=point);

[Maple Plot]

> plot([seq([n,n/(n+1)],n=5..100)],style=point);

[Maple Plot]

> plot([seq([n,n/(n+1)],n=9..100)],style=point);

[Maple Plot]

It looks like if 9 < n , then the abs(n/(n+1)-1) < .1 , so the N called for in the definition can be taken as N=9.

Submission:

(a) Use a graph to guess the value of the limit limit(n^5/n!,n = infinity) .

(b) Use a graph of the sequence in part (a) to find the smallest values of N that correspond to epsilon = 0.1 and

epsilon = 0.001 .

Submission worksheet:

>

3. Sequences-pattern recognition.

A sequence is a function whose domain is the set of positive integers . Depending on the context, we can define these objects in different ways with Maple. For instance, the sequence whose n 'th term is given by a[n] = n/(2*n+1) can be defined as a function of the variable n as follows:

> a1:=n->n/(2*n+1);

a1 := proc (n) options operator, arrow; n/(2*n+1) e...

Also, if we only want to look at a few of the terms of the sequence, we could use the seq command in Maple to generate them as follows:

> a2 := [seq(n/(2*n+1),n=1..20)];

a2 := [1/3, 2/5, 3/7, 4/9, 5/11, 6/13, 7/15, 8/17, ...

What are the differences? In a1, we can ask for the 500th element of the sequence, but since we only generated 20 elements for a2 we can't do this. Also, there is a subtle distinction in how you refer to an element of the sequence with these two notations. Suppose, for example, we want the 15th element. Then notice the use of the parentheses and square braces below:

> a1(15); a2[15];

15/31

15/31

On the other hand, what if we try to print the 500'th element in the sequence.

> a1(500); a2[500];

500/1001

Error, invalid subscript selector

The error message results because a2[500] is not defined.

Submission:

For the following sequences:

a) Find a formula for the sequence as a function.

b) Use the seq command to generate the first 25 terms of the sequence.

c) Check that both versions give the same value for the 20'th element of the sequence.

1) 1, -1, 1, -1, 1 , . . .

2) 1, -4, 9, -16, 25 , . . .

3) 2, 6, 10, 14, 18 , . . .

4) 1, 0, 1, 0, 1 , . . .

Submission worksheet:

>

4. The graph of a sequence.

In order to investigate properties of a sequence it is sometimes helpful to look at its graph. The graph of a sequence can be thought of as a set of ordered pairs where the first coordinate is always a positive integer. Thus the graph of a sequence is a collection of disconnected dots. To plot such objects with Maple, we must give it a list of ordered pairs. For example, to get a graph of (a finite portion) of the sequence in the example in activity 1, we plot the first 100 pairs as follows:

> plot([seq([n,n/(2*n+1)],n=1..100)],style=point);

[Maple Plot]

This graph is pretty helpful to us in determining properties of the sequence. First, it looks as if the sequence is monotonically increasing, and appears to be bounded about by 1/2, which would make it convergent by the Monotone Sequence Theorem. In fact, the sequence appears to converge to 1/2, which we can verify directly, by using Maple to take a limit.

> Limit(n/(2*n+1),n=infinity)=limit(n/(2*n+1),n=infinity);

Error, (in Limit) unable to determine value of limit variable

Since the limit as proc (n) options operator, arrow; infinity end proc... of both the numerator and denominator is infinity , we can use L'Hopital's rule to calculate this limit as well.

> Limit(n/(2*n+1),n=infinity)=diff(n,n)/diff(2*n+1,n);

Error, (in Limit) unable to determine value of limit variable

The method of graphing can also yield evidence that a series which is not monotonic converges, and allow one to estimate the value to which the sequence converges. For example, consider the graph of the sequence a[n] = (-2/3)^n below.

> plot([seq([n,(-2/3)^n],n=1..100)],style=point);

[Maple Plot]

The sequence appears to be bounded both above (by 4/9) and below (by -2/3), alternating between positive and negative values, and convergent to 0. Let us confirm this fact by taking the limit in Maple.

> Limit((-2/3)^n,n=infinity)=limit((-2/3)^n,n=infinity);

Error, (in Limit) unable to determine value of limit variable

Submission:

For the sequences below,

a) Graph the first 100 terms of the sequence.

b) Decide if the graph indicates that the sequence is monotone increasing or decreasing, or neither.

c) Estimate the limit from the graph

d) Confirm your limit estimate by using Maple to compute the limit.

1) a[n] = n^(1/n)

2) a[n] = sin(n)/n

3) a[n] = n*sin(1/n)

4) a[n] = sin(n)

Submission worksheet:

>

>

>