sum.tex 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. \chapter{SUM: A package for series summation}
  2. \label{SUM}
  3. \typeout{{SUM: A package for series summation}}
  4. {\footnotesize
  5. \begin{center}
  6. Fujio Kako \\
  7. Department of Mathematics, Faculty of Science \\
  8. Hiroshima University \\
  9. Hiroshima 730, JAPAN \\[0.05in]
  10. e--mail: kako@ics.nara-wu.ac.jp
  11. \end{center}
  12. }
  13. \ttindex{SUM}
  14. \index{Gosper's Algorithm}\index{SUM operator}\index{PROD operator}
  15. This package implements the Gosper algorithm for the summation of series.
  16. It defines operators SUM and PROD. The operator SUM returns the indefinite
  17. or definite summation of a given expression, and the operator PROD returns
  18. the product of the given expression. These are used with the syntax:
  19. \vspace{.1in}
  20. \noindent{\tt SUM}(EXPR:{\em expression}, K:{\em kernel},
  21. [LOLIM:{\em expression} [, UPLIM:{\em expression}]]) \\
  22. \noindent{\tt PROD}(EXPR:{\em expression}, K:{\em kernel},
  23. [LOLIM:{\em expression} [, UPLIM:{\em expression}]])
  24. If there is no closed form solution, these operators return the input
  25. unchanged. UPLIM and LOLIM are optional parameters specifying the lower
  26. limit and upper limit of the summation (or product), respectively. If UPLIM
  27. is not supplied, the upper limit is taken as K (the summation variable
  28. itself).
  29. For example:
  30. \begin{verbatim}
  31. sum(n**3,n);
  32. sum(a+k*r,k,0,n-1);
  33. sum(1/((p+(k-1)*q)*(p+k*q)),k,1,n+1);
  34. prod(k/(k-2),k);
  35. \end{verbatim}
  36. Gosper's algorithm succeeds whenever the ratio
  37. \[ \frac{\sum_{k=n_0}^n f(k)}{\sum_{k=n_0}^{n-1} f(k)} \]
  38. \noindent is a rational function of $n$. The function SUM!-SQ
  39. handles basic functions such as polynomials, rational functions and
  40. exponentials.\ttindex{SUM-SQ}
  41. The trigonometric functions sin, cos, {\em etc.\ }are converted to exponentials
  42. and then Gosper's algorithm is applied. The result is converted back into
  43. sin, cos, sinh and cosh.
  44. Summations of logarithms or products of exponentials are treated by the
  45. formula:
  46. \vspace{.1in}
  47. \hspace*{2em} \[ \sum_{k=n_0}^{n} \log f(k) = \log \prod_{k=n_0}^n f(k) \]
  48. \vspace{.1in}
  49. \hspace*{2em} \[ \prod_{k=n_0}^n \exp f(k) = \exp \sum_{k=n_0}^n f(k) \]
  50. \vspace{.1in}
  51. Other functions can be summed by providing LET rules which must relate the
  52. functions evaluated at $k$ and $k - 1$ ($k$ being the summation variable).
  53. \begin{verbatim}
  54. operator f,gg; % gg used to avoid possible conflict with high energy
  55. % physics operator.
  56. for all n,m such that fixp m let
  57. f(n+m)=if m > 0 then f(n+m-1)*(b*(n+m)**2+c*(n+m)+d)
  58. else f(n+m+1)/(b*(n+m+1)**2+c*(n+m+1)+d);
  59. for all n,m such that fixp m let
  60. gg(n+m)=if m > 0 then gg(n+m-1)*(b*(n+m)**2+c*(n+m)+e)
  61. else gg(n+m+1)/(b*(n+m+1)**2+c*(n+m+1)+e);
  62. sum(f(n-1)/gg(n),n);
  63. f(n)
  64. ---------------
  65. gg(n)*(d - e)
  66. \end{verbatim}