Part A --- Review of seq and introduction of add (7 minutes)
Recall that seq makes sequences. For example:
> seq( 3^k, k = 3 .. 15 );
Exercise (do it now, but not to turn in): use seq to create the sequence 1, , , , , ...
> seq( x^k, k=0..12);
The add command works exactly like seq, except that it adds together the terms instead of putting them in a sequence. For example:
> add( x^k, k = 3 .. 15 );
Exercise (do it now, but not to turn in): use add to create the sum + ... +
> add(n*y^n,n=1..13);
Note that for both
seq
and
add
:
1. The variable is a "dummy" variable local to the command.
2. The boundaries of the sequence/sum must evaluate to
explicit numbers
when the sequence/sum is evaluated.
For example, note the variable
k
:
>
k := 3.963;
add( k, k = 1 .. 5 );
k;
and note that the following fails (in contrast to the closely related but quite different function sum that we will investigate later; for now avoid the use of sum !)
>
restart;
add( k, k = 1 .. n );
Error, unable to execute add
>
> add((-1)^k*x^k,k=0..8);
>