REDUCE

20.57 SUM: A Package for Series Summation

This package implements the Gosper algorithm for the summation of series. It defines operators SUM and PROD. The operator SUM returns the indefinite or definite summation of a given expression, and PROD returns the product of the given expression.

This package loads automatically.

Author: Fujio Kako.

This package implements the Gosper algorithm for the summation of series. It defines operators sum and prod. The operator sum returns the indefinite or definite summation of a given expression, and the operator prod returns the product of the given expression. These are used with the syntax:

sum(\(\langle \)expr:expression\(\rangle \),\(\langle \)k:kernel\(\rangle \)[,\(\langle \)lolim:expression\(\rangle \)[,\(\langle \)uplim:expression\(\rangle \)]])
prod(\(\langle \)expr:expression\(\rangle \),\(\langle \)k:kernel\(\rangle \)[,\(\langle \)lolim:expression\(\rangle \)[,\(\langle \)uplim:expression\(\rangle \)]])

If there is no closed form solution, these operators return the input unchanged. \(\langle \)lolim\(\rangle \) and \(\langle \)uplim\(\rangle \) are optional parameters specifying the lower limit and upper limit of the summation (or product), respectively. If \(\langle \)uplim\(\rangle \) is not supplied, the upper limit is taken as \(\langle \)k\(\rangle \) (the summation variable itself).

For example:

     sum(n**3,n);

     sum(a+k*r,k,0,n-1);

     sum(1/((p+(k-1)*q)*(p+k*q)),k,1,n+1);

     prod(k/(k-2),k);

Gosper’s algorithm succeeds whenever the ratio \[ \frac {\sum _{k=n_0}^n f(k)}{\sum _{k=n_0}^{n-1} f(k)} \] is a rational function of \(n\). The function sum!-sq handles basic functions such as polynomials, rational functions and exponentials.

The trigonometric functions sin, cos, etc. are converted to exponentials and then Gosper’s algorithm is applied. The result is converted back into sin, cos, sinh and cosh.

Summations of logarithms or products of exponentials are treated by the formula: \begin {gather*} \sum _{k=n_0}^{n} \log f(k) = \log \prod _{k=n_0}^n f(k) \\ \prod _{k=n_0}^n \exp f(k) = \exp \sum _{k=n_0}^n f(k) \end {gather*} Other functions, as shown in the test file for the case of binomials and formal products, can be summed by providing LET rules which must relate the functions evaluated at \(k\) and \(k - 1\) (\(k\) being the summation variable).

There is a switch trsum (default off). If this switch is on, trace messages are printed out during the course of Gosper’s algorithm.


Hosted by Download REDUCE Powered by MathJax