LAB 6- Sequences and seriesPreliminariesrestart: with(plots):SequencesFor the example, we want to study a sequence {a_n}. Remember that this is just a function whose domain is {1,2,3,...}. It will be convenient to have maple work with functions rather than expressions. We define the function by a formula:a:=n->1/(n^2+1);We can tell maple to give us the first few terms using the "seq" command, which is similar to "int":
seq(a(n),n=1..10);What we really want to look at is the sequence of points (n,a(n)), to get the graph of {a_n}. Maple wants us to use brackets [ ] rather than parentheses ( ) for the points, and it wants us to tell it how many points. Since we want to refer to the sequence of points, we give it a name:aplot:=seq([n,a(n)],n=1..10);
We want maple to plot this sequence of points:plot([aplot],style=point);Note that maple wanted brackets [ ] around the name of the sequence of points, and we used "style=point" to get the points by themselves; otherwise maple would have connected the points with line segments.SeriesIf the partial sums of a series approaches to a limit.then the series converges.Example 1Now we want to study the sequence of partial sums of a series whose terms are a_n. For this we need the maple command "sum"a:=n->1/(n^2+1); s:=n->sum(a(k),k=1..n);
Note that we used a "dummy index" k, since "n" was being used for something else.
Again, we want to plot the sequence {s_n}:splot:=seq([n,s(n)],n=1..25);plot([splot],style=point);Example 2Two series are investigated below. The series NiMtJSRzdW1HNiQqJiIiIkYnKiYiIzVGJyUibkdGJyEiIi9GKjtGJyUpaW5maW5pdHlH diverges while the series NiMtJSRzdW1HNiQqJiksJCIiIiEiIiwmJSJuR0YpRilGKUYpRixGKi9GLDtGKSUpaW5maW5pdHlH coverges. These results can be shown to be true using convergence tests for series. The commands below are used to compute partial sums and compare them to illustrate convergence and divergence.restart;i:='i':a:=array(1..12000);Digits:=5:for i from 1 to 12000 by 1000 do
a[i]:=evalf(sum(1/(10*j),j=1..i));b[i]:=evalf(sum((-1)^(j+1)*1/j,j=1..i));od;matrix(2,12,[Sum(1/[10*n]),seq(a[1+1000*t],t=1..11),Sum((-1)^(n+1)/n),seq(b[1+1000*r],r=1..11)]);with(plots):setoptions(thickness=2):f:=plot({seq([1+1000*t,a[1+1000*t]],t=1..11)},style=point,color=red):g:=plot({seq([1+1000*t,b[1+1000*t]],t=1..11)},style=point,color=blue):h:=textplot([8000,.99,`Diverges`],color=red):k:=textplot([8000,.72,`Converges`],color=blue):display({f,g,h,k},view=[0..12000,.65..1]);Approximating functions with seriesIn the following section we will plot together functions and their approximating polynomials:restart: with(plots): a:=n-> x^n; s4:=sum(a(k),k=0..4); f:= 1/(1-x); s10:=sum(a(k),k=0..10); s20:=sum(a(k),k=0..20);plot ({f,s4,s10, s20}, x= -2..2, y=-1..1);a:=n-> (1/2)*((x+1)/2)^n; s4:=sum(a(k),k=0..4); f:= 1/(1-x); s10:=sum(a(k),k=0..10); s20:=sum(a(k),k=0..20);plot ({f,s4,s10, s20}, x= -6..2, y=-1..1);a:=n-> (1/3)*((x+2)/3)^n; s4:=sum(a(k),k=0..4); f:= 1/(1-x); s10:=sum(a(k),k=0..10); s20:=sum(a(k),k=0..20);plot ({f,s4,s10, s20}, x= -6..2, y=-1..1);a:=n-> 2*((-x)/2)^n; s4:=sum(a(k),k=0..4); f:= 4/(2+x); s9:=sum(a(k),k=0..9); s20:=sum(a(k),k=0..20);plot ({f,s4,s9, s20}, x= -2..6, y=-1..6);Exercises to turn inProblem 1define the sequence {a_n} given below, then execute the same commands as in the sequence section and as in example 1 in the series section. Discuss the limit of the sequence and of the series.
Next, explore the use of the lim command to confirm your limits.
a:=n->(-6)^(n-1)/5^(n-1);Problem 2Repeat the processes (as needed) to determine the convergence or divergence of 2 series (of your choice) listed in the homework of section 11.7Problem 3Find a series approximation for the function f(x) = 3/(x+2). Generate the terms of the series for 3 different values and plot together the function and the 3 series approximations.