**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)};**

`> `
**with(plots):**

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

`> `
**display(plotlist, insequence=true);**

`> `

**Problem 2.**

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

(b) Let
*g51*
be defined as the function that follows the above pattern, ending with
:

Write
as a Maple function (using the
*add*
command, of course!)

(c) Calculate the exact value of
when
is 7.

a)

`> `
**restart;**

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

b)

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

`> `
**subs(x=7,g51);**

`> `

`> `

**Problem 3.**

Consider the following function:

(a) Write
as a Maple function (using the
*add*
command, of course!)

(b) Calculate the exact value of
when
is 7.

(c) Find a good decimal approximation to the value of
when
is 7.

`> `
**restart;**

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

`> `
**subs(x=7,hx);**

`> `
**evalf(%);**

`> `

`> `

**Problem 4 (counts as two problems).**

Consider the following collection of functions:

and so forth.

(a) Define the Maple functions
,
and
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
,
and
, 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 .

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

(c) Try to use the graph you just produced to determine (accurate to three significant figures)
**the smallest positive **
** 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
. 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
for which the functions
and
differ by more than 1.0.

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

`> `
**restart;**

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

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

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

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

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

b) the equations are extremely close

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

c) they are 1 apart at approximately x = 6.60

`> `

d)

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

`> `

`> `

`> `

`> `
**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);**

`> `

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.