Opened 8 years ago

Closed 6 years ago

#11894 closed defect (fixed)

problems with infinite sum

Reported by: tmonteil Owned by: burcin
Priority: trivial Milestone: sage-6.3
Component: calculus Keywords: infinite sum, maxima
Cc: tmonteil Merged in:
Authors: Peter Bruin Reviewers: Karl-Dieter Crisman
Report Upstream: Fixed upstream, in a later stable release. Work issues:
Branch: 1dd0f05 (Commits) Commit: 1dd0f05a2421b2ecda14066a0c1dbe4b5bd6f38e
Dependencies: #13973, #13712 Stopgaps:

Description

A recent post on the number theory list asked to compute the value of the infinite sum of 1/(m^4 + 2m^3 + 3m^2 + 2m)^2 for m between 1 and infinity.

https://listserv.nodak.edu/cgi-bin/wa.exe?A2=ind1109&L=nmbrthry&T=0&P=1149

Trying it to sage :

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

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:

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

It is also not able to take the real part of a real number:

sage: CC(s)
0.0161011600422853
sage: RR(s)
[...]
TypeError: cannot convert -7*I to real number

Moreover, if we let m start to zero, sage does not provide an error but a value:

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

Change History (9)

comment:1 Changed 8 years ago by kcrisman

Hmm, you have quite a few things here. But which of these are a bug, or should be the main focus of this report?

  1. 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.)
  2. False just means "can't prove it's True". For this complicated of an expression, it would be very difficult for bool 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?
  3. RR 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.
  4. Hmm, this would be a bug in Maxima. We do get the correct error without the infinity.
    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
    
    I've logged this as a Maxima bug.

comment:2 Changed 6 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:3 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:4 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:5 Changed 6 years ago by pbruin

  • Dependencies set to #13973
  • Report Upstream changed from N/A to Fixed upstream, in a later stable release.

The bug in item 4 is fixed upstream and after #13973 the code does correctly raise an error:

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.

comment:6 follow-up: Changed 6 years ago by pbruin

  • Authors set to Peter Bruin
  • Branch set to u/pbruin/11894-maxima_sum_zero_division
  • Commit set to 1dd0f05a2421b2ecda14066a0c1dbe4b5bd6f38e
  • Dependencies changed from #13973 to #13973, #13712
  • Priority changed from major to trivial
  • Status changed from new to needs_review

Here is a doctest. The dependence on #13712 is because the test is inserted directly after the one there.

Points 2 and 3 have in my opinion been answered in comment:1. 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.

comment:7 in reply to: ↑ 6 Changed 6 years ago by kcrisman

Points 2 and 3 have in my opinion been answered in comment:1. 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.

Yes, that was essentially my point then. In principle that could be another ticket but I'm not worried about it.

comment:8 Changed 6 years ago by kcrisman

  • Reviewers set to Karl-Dieter Crisman
  • Status changed from needs_review to positive_review

comment:9 Changed 6 years ago by vbraun

  • Branch changed from u/pbruin/11894-maxima_sum_zero_division to 1dd0f05a2421b2ecda14066a0c1dbe4b5bd6f38e
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.