Sage: Ticket #11894: problems with infinite sum
https://trac.sagemath.org/ticket/11894
<p>
A recent post on the number theory list asked to compute the value of the infinite sum of <code>1/(m^4 + 2m^3 + 3m^2 + 2m)^2</code> for <code>m</code> between 1 and infinity.
</p>
<p>
<a class="ext-link" href="https://listserv.nodak.edu/cgi-bin/wa.exe?A2=ind1109&L=nmbrthry&T=0&P=1149"><span class="icon"></span>https://listserv.nodak.edu/cgi-bin/wa.exe?A2=ind1109&L=nmbrthry&T=0&P=1149</a>
</p>
<p>
Trying it to sage :
</p>
<pre class="wiki">sage: var('m')
sage: s = sum(1/(m^4 + 2*m^3 + 3*m^2 + 2*m)^2, m, 1, infinity)
sage: s
1/12*pi^2 + 9/196*I*sqrt(7)*psi(1/14*(3*sqrt(7) - 7*I)*sqrt(7)) -
9/196*I*sqrt(7)*psi(1/14*(3*sqrt(7) + 7*I)*sqrt(7)) - 1/28*psi(1,
-1/2*I*sqrt(7) + 3/2) - 1/28*psi(1, 1/2*I*sqrt(7) + 3/2) - 1
</pre><p>
The formula is less elegant than the formulas given by people who answered using two proprietary sfotwares, but does not seem false. Sage is not able to regognize it:
</p>
<pre class="wiki">sage: bool(s == (-(19/16) + 1/84 * pi^2 * (7 - 3 * sech((sqrt(7) *
pi)/2)^2) + ( 9 * pi * tanh((sqrt(7) * pi)/2))/(28 * sqrt(7))))
False
sage: bool(s == -19/16 + 1/28*pi^2*tanh(1/2*pi*7^(1/2))^2 +
9/196*7^(1/2)*pi*tanh(1/2*pi*7^(1/2)) + 1/21*pi^2)
False
</pre><p>
It is also not able to take the real part of a real number:
</p>
<pre class="wiki">sage: CC(s)
0.0161011600422853
sage: RR(s)
[...]
TypeError: cannot convert -7*I to real number
</pre><p>
Moreover, if we let <code>m</code> start to zero, sage does not provide an error but a value:
</p>
<pre class="wiki">sage: var('m')
sage: s = sum(1/(m^4 + 2*m^3 + 3*m^2 + 2*m)^2, m, 0, infinity)
sage: s
1/12*pi^2 + 9/196*I*sqrt(7)*psi(1/14*(sqrt(7) - 7*I)*sqrt(7)) -
9/196*I*sqrt(7)*psi(1/14*(sqrt(7) + 7*I)*sqrt(7)) - 1/28*psi(1,
-1/2*I*sqrt(7) + 1/2) - 1/28*psi(1, 1/2*I*sqrt(7) + 1/2)
sage: CC(s)
1.20360116004229
</pre>en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/11894
Trac 1.1.6kcrismanTue, 04 Oct 2011 18:57:48 GMT
https://trac.sagemath.org/ticket/11894#comment:1
https://trac.sagemath.org/ticket/11894#comment:1
<p>
Hmm, you have quite a few things here. But which of these are a bug, or should be the main focus of this report?
</p>
<ol><li>I'm thankful that Maxima provides this for us at all, though of course summation could be better. I assume it is correct if numerically approximated? (I don't know the answer that this should give.)
</li><li><code>False</code> just means "can't prove it's True". For this complicated of an expression, it would be very difficult for <code>bool</code> to prove this. Again, could be enhanced, but not a bug. You may wish to see if some of the Maxima simplifications could help with this?
</li><li><code>RR</code> does not take the real part of a number. That said, we should have something that checks this, I think, unless there is an arcane reason (in this huge expression) we can't.
</li><li>Hmm, this would be a bug in Maxima. We do get the correct error without the infinity.
<pre class="wiki">sage: sage: s = sum(1/(m^4 + 2*m^3 + 3*m^2 + 2*m)^2, m, 0, 3)
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
RuntimeError: ECL says: Error executing code in Maxima: Division by 0
</pre>I've logged this <a class="ext-link" href="https://sourceforge.net/tracker/?func=detail&aid=3418608&group_id=4933&atid=104933"><span class="icon"></span>as a Maxima bug</a>.
</li></ol>
TicketjdemeyerTue, 13 Aug 2013 15:35:53 GMTmilestone changed
https://trac.sagemath.org/ticket/11894#comment:2
https://trac.sagemath.org/ticket/11894#comment:2
<ul>
<li><strong>milestone</strong>
changed from <em>sage-5.11</em> to <em>sage-5.12</em>
</li>
</ul>
Ticketvbraun_spamThu, 30 Jan 2014 21:20:52 GMTmilestone changed
https://trac.sagemath.org/ticket/11894#comment:3
https://trac.sagemath.org/ticket/11894#comment:3
<ul>
<li><strong>milestone</strong>
changed from <em>sage-6.1</em> to <em>sage-6.2</em>
</li>
</ul>
Ticketvbraun_spamTue, 06 May 2014 15:20:58 GMTmilestone changed
https://trac.sagemath.org/ticket/11894#comment:4
https://trac.sagemath.org/ticket/11894#comment:4
<ul>
<li><strong>milestone</strong>
changed from <em>sage-6.2</em> to <em>sage-6.3</em>
</li>
</ul>
TicketpbruinSat, 17 May 2014 13:39:41 GMTupstream changed; dependencies set
https://trac.sagemath.org/ticket/11894#comment:5
https://trac.sagemath.org/ticket/11894#comment:5
<ul>
<li><strong>dependencies</strong>
set to <em>#13973</em>
</li>
<li><strong>upstream</strong>
changed from <em>N/A</em> to <em>Fixed upstream, in a later stable release.</em>
</li>
</ul>
<p>
The bug in item 4 is fixed upstream and after <a class="closed ticket" href="https://trac.sagemath.org/ticket/13973" title="defect: Upgrade Maxima to 5.33.0 (closed: fixed)">#13973</a> the code does correctly raise an error:
</p>
<pre class="wiki">sage: sum(1/(m^4 + 2*m^3 + 3*m^2 + 2*m)^2, m, 0, infinity)
#0: simp_gen_harmonic_number(exp__=1,x__=-1)
#1: ratfun_to_psi(ratfun=1/(m^8+4*m^7+10*m^6+16*m^5+17*m^4+12*m^3+4*m^2),var=m,lo=0,hi=inf)
#2: simplify_sum(expr='sum(1/(m^4+2*m^3+3*m^2+2*m)^2,m,0,inf))
...
RuntimeError: ECL says: Error executing code in Maxima: Zero to negative power computed.
</pre>
TicketpbruinThu, 29 May 2014 21:43:06 GMTstatus, priority, dependencies changed; author, branch, commit set
https://trac.sagemath.org/ticket/11894#comment:6
https://trac.sagemath.org/ticket/11894#comment:6
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>needs_review</em>
</li>
<li><strong>author</strong>
set to <em>Peter Bruin</em>
</li>
<li><strong>priority</strong>
changed from <em>major</em> to <em>trivial</em>
</li>
<li><strong>dependencies</strong>
changed from <em>#13973</em> to <em>#13973, #13712</em>
</li>
<li><strong>branch</strong>
set to <em>u/pbruin/11894-maxima_sum_zero_division</em>
</li>
<li><strong>commit</strong>
set to <em>1dd0f05a2421b2ecda14066a0c1dbe4b5bd6f38e</em>
</li>
</ul>
<p>
Here is a doctest. The dependence on <a class="closed ticket" href="https://trac.sagemath.org/ticket/13712" title="defect: wrong evaluation of infinite sum (closed: fixed)">#13712</a> is because the test is inserted directly after the one there.
</p>
<p>
Points 2 and 3 have in my opinion been answered in <a class="ticket" href="https://trac.sagemath.org/ticket/11894#comment:1" title="Comment 1">comment:1</a>. Point 1 (the result could be simplified more nicely) is something that should be done in Maxima (simplify certain sums of two polygamma functions to trigonometric functions), so I think it shouldn't be an obstacle to closing this ticket.
</p>
TicketkcrismanFri, 30 May 2014 02:19:25 GMT
https://trac.sagemath.org/ticket/11894#comment:7
https://trac.sagemath.org/ticket/11894#comment:7
<blockquote class="citation">
<p>
Points 2 and 3 have in my opinion been answered in <a class="ticket" href="https://trac.sagemath.org/ticket/11894#comment:1" title="Comment 1">comment:1</a>. Point 1 (the result could be simplified more nicely) is something that should be done in Maxima (simplify certain sums of two polygamma functions to trigonometric functions), so I think it shouldn't be an obstacle to closing this ticket.
</p>
</blockquote>
<p>
Yes, that was essentially my point then. In principle that could be another ticket but I'm not worried about it.
</p>
TicketkcrismanFri, 30 May 2014 02:22:25 GMTstatus changed; reviewer set
https://trac.sagemath.org/ticket/11894#comment:8
https://trac.sagemath.org/ticket/11894#comment:8
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>positive_review</em>
</li>
<li><strong>reviewer</strong>
set to <em>Karl-Dieter Crisman</em>
</li>
</ul>
TicketvbraunMon, 02 Jun 2014 12:54:42 GMTstatus, branch changed; resolution set
https://trac.sagemath.org/ticket/11894#comment:9
https://trac.sagemath.org/ticket/11894#comment:9
<ul>
<li><strong>status</strong>
changed from <em>positive_review</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
<li><strong>branch</strong>
changed from <em>u/pbruin/11894-maxima_sum_zero_division</em> to <em>1dd0f05a2421b2ecda14066a0c1dbe4b5bd6f38e</em>
</li>
</ul>
Ticket