:

## Series and Tests for Their Convergence

A question was asked in the forums about series tests. I saw that this would also make an excellent weblog entry as well. In answer to the questions: How can I get Maple to determine if a series converges or diverges? and How can I obtain the general representation of a formal power series for a function? I offer the following advice: For example, to apply the ratio test to the series Sum(1/2^n, n=0..infinity), define
```> a := n -> 1/2^n:
> 'a'[n] = a(n);
```
then compute
```> r = limit(a(n+1)/a(n), n=infinity);
```
I suggest two lines to define a[n]. The first defines it as a functin of n, the second displays it more naturally. The left side of the output of the second line appears as a[n], whereas the right side appears as 1/2^n. Similar computations apply to the nth-root test, etc. There is no single command for determining the convergence or divergence of a series. If the whole series is entered as
```> S := Sum(1/2^n, n=0..infinity);
```
then the command
```> value(S);
```
will produce a finite result, in which case it's clear the series converged. If Maple can determine the series diverges, it will return the symbol "infinity" or -infinity. If Maple returns unevaluated, it means that Maple could not determine a limit for the partial sums, but that does not mean such a limit does not exist. It only means that Maple couldn't determine that limit. There is no single command in Maple for writing the general term in a series. The taylor (or series) commands produce a partial sum, with the terms written out (not in in sigma-notation). However, the nth derivative of an expression can be computed. Hence, it is possible to build the general form of a series expansion. For example, to obtain the general expansion of sin(x) at x = 0, implement the following commands.
```> q := eval(diff(sin(x),x\$n)/n!, x=0);
> q1 := simplify(eval(q, n=2*k+1)) assuming k::posint;
```
The first command produces sin(n*Pi/2)/n! whereas the second produces (-1)^k/(2*k+1)!. User insight and intervention is definitely needed here! The requisite Maclaurin expansion is then obtained with
```> Sum(q1*x^(2*k+1), k=0..infinity);
```
The Share Library, a repository for code contributed by users, contained the FPS package with its FormalPowerSeries command. This command would return the formal power series in sigma notation. However, the Share Library is no longer available. ﻿