Is there a bug in sum() ? (MAPLE 5 and MAPLE 6.01)
> restart: > Sum(exp(-k)/k,k=1..infinity):%=value(%); infinity ----- \ exp(-k) ) ------- = -ln(1 - exp(-1)) / k ----- k = 1
This result seems correct but what does the following meens ?
> Sum(exp(k)/k,k=1..infinity):%=value(%); infinity ----- \ exp(k) ) ------ = -ln(1 - exp(1)) / k ----- k = 1 > evalc(rhs(%)); -ln(exp(1) - 1) - I Pi
I expect infinity.
It is corrected with Maple 7. (U. Klein)
Totally correct.
The help page for "sum" says:
"Note that sum knows about various resummation methods and will thus be able to give the ’correct’ value for various classes of divergent sums. If one wants to restrict summation to convergent sums, then explicit convergence checks must be done."
Actually I think this is a bit misleading: Maple is not really using fancy summability
methods, it is just not checking for convergence and thus uses formulas such as (in this
case) sum(r^k/k, k=1..infinity) = -ln(1-r) outside the region where the sum
converges.
I have a procedure "csum" in my Maple Advisor Database that attempts to check whether a sum converges. For example:
> csum(exp(-k)/k, k); true > csum(exp(k)/k, k); false \begin{nowrap}\begin{MAPLEinline} See \href{http://www.math.ubc.ca/~israel/advisor}{www.math.ubc.ca/~israel/advisor} %%%%% \clearpage\section{bug in sum, Maple 7 and Maple 8 (22.5.02)} %%%%%%%%%%%%%%%%%%%%% \subsection{\href{mailto:max_joern@web.de}{Jorn Justiz}} I recently stumbled over this sum: (I'm using Maple 7) \begin{nowrap}\begin{MAPLEinline} Sum((k+1)*ee^k,k = 3 .. infinity);
This should converge for abs(ee)<1. We know that the sum from 0 to infinity equals in
that case 1/(1-ee)^2 which is checked by maple:
(no convergence check b.t.w.)
If we plug in \(ee=-0.5\) we obtain:
Now Sum((k+1)*ee^k,k = 3 .. infinity) should be
Sum((k+1)*ee^k,k = 0 .. infinity) - Sum((k+1)*ee^k,k = 0 .. 2), right? This we
can calculate for the case \(ee=-0.5\) to be equal to \(0.4444444-0.75= -.3055555556\). But here the surprise: if we use maple to
calculate the sum from 3 to infinity with arbitrary value of ee first and then substitute \(ee=-0.5\) we
get:
> sum((k+1)*(ee)^k,k=3..infinity); 4*ee^3*(-9/ee^(1/2)/(-ee+1)^2*LegendreP(1,-3,(ee+1)/(-ee+1)) -3/2*1/(ee-1)^5*(-ee+1)^2/ee+1/(ee-1)^5*(-ee+1)^2/ee^2 -1/4*1/(ee-1)^5*(-ee+1)^2/ee^3-1/4*1/ee^3*(-ee+1)) > evalf(subs(ee=-0.5,%)); -.1666666667-0.*I
which is clearly different from the expected result. I assume that already the expression with the associated Legendre functions is wrong but I’m not sure. We get the expected result though if we take the limit:
> sum((k+1)*(ee)^k,k=3..n); ee^(n+1)*(-2+(n+1)*ee-n)/(ee-1)^2-ee^3*(-4+3*ee)/(ee-1)^2 >limit(subs(ee=-0.5,%),n=infinity); -.3055555556
I suppose, this is a bug?
You identified a BUG.
> kernelopts(version); `Maple 7.00, IBM INTEL NT, May 28 2001 Build ID 96223` > sum((k+1)*a^k, k=2..infinity): evalf(subs(a=1/2, %)); 12. > sum((k+1)*(1/2)^k, k=2..infinity); 2
This bug is absent in Maple V, Release 5
> kernelopts(version); Maple V, Release 5, IBM INTEL NT, Nov 27 1997, WIN-55NC-567980-7 > sum((k+1)*a^k,k=2..infinity): evalf(subs(a=1/2, %)); 2.
I think that the expression with LegendreP is OK, but think that the problem lies in the
procedure `evalf/LegendreP`. In that procedure’s statement 18 all values of
LegendreP(v,u,z) having integral values of v and u and having v<abs(u) are set to
0.
From Abramowitz & Stegun 8.1.2 we find that
Maple itself simplifies the right hand side to 1/12*x^(3/2)*(x-2)/(x-1). If you in the
output from sum((k+1)*x^k,k=3..infinity); replace LegendreP(...) with this
expression, then the sum-result is seen to be correct.
If I’m correct in claiming that there is a bug in `evalf/LegendreP` then the bug is
present in Maple V, 5.1, Maple 6, Maple 7, and unfortunately also in Maple
8.
In Maple V, 5.1 and Maple 6 your problem with the sum doesn’t show up since the result doesn’t contain LegendreP.