Maple Introduction, Part 5:
Sequences and sums

Integrated, First-Year Curriculum in Science, Engineering, and Mathematics
Based on a notebook by Claude Anderson

Extensively revised by Kurt Bryan and David Mutchler

Format of today's session (1 minute)

Part A --- Review of seq and introduction of add (7 minutes)

Part B --- A jigsaw to learn more about the add command (35 minutes)

Part C --- Introduction to animation in Maple (animating plots) (7 minutes)

Part D --- Using iteration to create functions (10 minutes)

Homework

Complete Parts A through D before you begin the homework!

Homework instructions and due dates

Homework problems

Don't forget to begin thinking about these problems well before they are due.

Problem 1.

In the worksheet above, you animated the sequence of 9 functions of the form i*x , for i from 1 to 9. Following what you did there, animate the sequence of 9 functions of the form sin( i*x) , for i from 1 to 9. (As in the animation above, plot for x from -5 to 5.)

> restart:

> eq := sin(i*x):

> sinseq := {seq(eq,i=1..9)};

[Maple Math]

> with(plots):

> plotlist := [ seq( plot( eq, x = -5 .. 5 ), i = 1 .. 9 ) ]:

> display(plotlist, insequence=true);

[Maple Plot]

>

Problem 2.

(a) Write an add command that produces the following:

[Maple Math]

(b) Let g51 be defined as the function that follows the above pattern, ending with [Maple Math] :

[Maple Math]

Write [Maple Math] as a Maple function (using the add command, of course!)

(c) Calculate the exact value of [Maple Math] when [Maple Math] is 7.

a)

> restart;

> add(x^(3*n),n=1..10);

[Maple Math]

b)

> g51 := add(x^(3*n),n=1..17);

[Maple Math]

> subs(x=7,g51);

[Maple Math]

>

>

Problem 3.

Consider the following function:

[Maple Math]

(a) Write [Maple Math] as a Maple function (using the add command, of course!)

(b) Calculate the exact value of [Maple Math] when [Maple Math] is 7.
(c) Find a good decimal approximation to the value of
[Maple Math] when [Maple Math] is 7.

> restart;

> hx := add( ((-1)^(n+1))*(x^(n)/n^2) ,n=1..15);

[Maple Math]
[Maple Math]

> subs(x=7,hx);

[Maple Math]

> evalf(%);

[Maple Math]

>

>

Problem 4 (counts as two problems).

Consider the following collection of functions:
[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

and so forth.

(a) Define the Maple functions [Maple Math] , [Maple Math] and [Maple Math] similarly, but using an add command for each.
(Name the functions
f5 , f10 and f15 . I am using the subscript notation here just for readability.)


(b) Plot
[Maple Math] , [Maple Math] and [Maple Math] , on the same graph with different colors, for x from 0 to 4.

Notice that as the subscript gets larger, the graph looks more and more like the natural exponential function [Maple Math] .

(b) Just how close an approximation is it? Plot [Maple Math] and [Maple Math] on the same graph.

(c) Try to use the graph you just produced to determine (accurate to three significant figures) the smallest positive [Maple Math] for which the functions differ by more than 1.0. (Read that carefully!) You'll find the graph does not display enough information. So here's a better way (a trick worth remembering!): plot the graph of [Maple Math] . Now you should be able to answer the question.

(d) Another way to answer the question in the previous part would be to use fsolve . Do so now, obtaining an even more accurate estimate for the smallest positive [Maple Math] for which the functions [Maple Math] and [Maple Math] differ by more than 1.0.

(e) Finally, how is the accuracy of the approximation of [Maple Math] to [Maple Math] improved by adding more terms to the summation? Plot [Maple Math] , then [Maple Math] , both over the same range for which you plotted [Maple Math] , and see how much more accurate the approximation is.

> restart;

> f5 := add(x^n/n!,n=0..4);

[Maple Math]

> f10 := add(x^n/n!,n=0..10);

[Maple Math]

> f15 := add(x^n/n!,n=0..15);

[Maple Math]
[Maple Math]

> plot( {f5,f10,f15},x=0..4);

[Maple Plot]

> plot( {exp(x),f15},x=0..4);

[Maple Plot]

b) the equations are extremely close

> plot( {exp(x)-f15},x=6.5..6.7);

[Maple Plot]

c) they are 1 apart at approximately x = 6.60

>

d)

> fsolve(exp(x)-f15=1,x=6..7);

[Maple Math]

>

>

>

> f20 := add(x^n/n!,n=0..20):

> f25 := add(x^n/n!,n=0..25):

>

> plot( {exp(x),f20,f25},x=6.5..6.500005);

[Maple Plot]

>

if you look really close, you can see that there is a yellow line in there, these equations are about 333 times more accurate than the f15(x) was.