next up previous
Next: About this document Up: ODDS AND ENDS Previous: Finite Summation

Finite Sequences

A command useful for generating sequences of numbers, functions etc. arising from one `formula' is seq. Observe the result of executing the following statements

seq( i^2, i=3..7 );
seq( i^2, i={3,4,10,20} );
seq( sin(k*x), k=0..4 );
We now apply this to compare the graphs of and the Taylor expansions of (around x=0) of orders 1,3,5,7, over the interval .
readlib(mtaylor):
tay := proc(i) if type(i,numeric)                          Line Feed
                  then mtaylor( sin(x), [x=0], i+1 )       Line Feed
               else 'tay'(i) fi                            Line Feed
       end:
polylist := seq( tay(i), i={1,3,5,7} );         list of polynomial approx.
plot( {sin(x), polylist}, x=-2*Pi..2*Pi, y=-2..2 );
Pick out the graph of - it is the periodic one - and judge the quality of the approximations by the Taylor polynomials.



Peter Monk
Tue Aug 29 14:41:29 EDT 1995