Next: 2.Convergence of infinite series Up: INFINITE SERIES Previous: Objective.

## 1.Visualization of convergence and divergence with Maple.

A sequence is a function whose domain of definition is the set of nonnegative integers. We can plot terms of sequences with the SequencePlot command. Since this command was written at WPI and is not part of the commercially available Maple package, it has to be loaded before it can be used. The function which defines the terms of a sequence has to be defined outside of the SequencePlot command.

```  > readlib(SequencePlot):
> Seq1:=n->100+(9/8)^n*sin(n/2);
> SequencePlot(Seq1, 1..40);
```

For convergent sequences, optimal arguments can be used to include the limit and a tolerance range of width epsilon around the limit.

```  > Seq2:=n->1-sin(n/4)/1.1^n;
> SequencePlot(Seq2, 1..50,Lim=1,Eps=0.1);
```

In this example we see that if n>22, then the terms of the sequence deviate from its limit by less than 0.1.

Series can be visualized by plotting the sequence of their partial sums. The following commands allow us to plot the first twenty terms of the harmonic and alternating harmonic series respectively.

```  > HarmSer:=n->sum(1/k,k=1..n);
> SequencePlot(HarmSer, 1..20);
> AltHarmSer:=n->sum((-1)^(k-1)/k,k=1..n);
> SequencePlot(AltHarmSer, 1..20,Lim=ln(2),Eps=0.05);
```

The last plot also shows that in order to get the value of ln2 accurate up to one decimal, (i.e., with an error less than 0.05), one has to add up 10 or more terms of the alternating harmonic series.

D. Vermes
Wed Jan 29 08:52:09 EST 1997