REDUCE

16.67 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(EXPR:expression, K:kernel, [LOLIM:expression [, UPLIM:expression]]) PROD(EXPR:expression, K:kernel, [LOLIM:expression [, UPLIM:expression]])

If there is no closed form solution, these operators return the input unchanged. UPLIM and LOLIM are optional parameters specifying the lower limit and upper limit of the summation (or product), respectively. If UPLIM is not supplied, the upper limit is taken as K (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

∑n
--k=n0 f-(k)-
∑n -1 f (k)
  k=n0

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:

  

 n                 n
∑                 ∏
    logf (k ) = log     f (k )
k=n0              k=n0

  

  n                  n
 ∏                  ∑
    exp f (k ) = exp     f(k)
k=n0               k=n0

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.