How to compute sum(log(1-1/n^2),n,2,oo)?

53 views
Skip to first unread message

Alberto Verga

unread,
Apr 16, 2014, 6:19:06 AM4/16/14
to sage-s...@googlegroups.com
n = var('n')
sum
(log(1-1/n^2),n,2,oo)


do not give the answer -log(2), but a 0*infinity error.

Jori Mantysalo

unread,
Apr 16, 2014, 6:29:08 AM4/16/14
to sage-s...@googlegroups.com
limit(sum(log(1-1/n^2),n,2,x), x=oo)

--
Jori Mäntysalo

Alberto Verga

unread,
Apr 16, 2014, 8:58:34 AM4/16/14
to sage-s...@googlegroups.com
OK, but why we need to use "limit" to compute a convergent sum...?
For instance
    sum(1/n^2,n,2,oo)
gives pi^2/6-1

but 
    limit(sum(1/n^2,n,2,x), x=oo)
do not give a result...

kcrisman

unread,
Apr 16, 2014, 1:33:14 PM4/16/14
to sage-s...@googlegroups.com, Robert Dodier


On Wednesday, April 16, 2014 8:58:34 AM UTC-4, Alberto Verga wrote:
OK, but why we need to use "limit" to compute a convergent sum...?
For instance
    sum(1/n^2,n,2,oo)
gives pi^2/6-1

but 
    limit(sum(1/n^2,n,2,x), x=oo)
do not give a result...


This is interesting.  In Sage's Maxima:

(%i1) load(simplify_sum);


(%i9) simplify_sum(sum(1/x^2,x,2,inf));
                                      2
                                   %pi
(%o9)                              ---- - 1
                                    6
(%i10) sum(log(1-1/x^2),x,2,inf);
                               inf
                               ====
                               \             1
(%o10)                          >    log(1 - --)
                               /              2
                               ====          x
                               x = 2
(%i11) simplify_sum(sum(log(1-1/x^2),x,2,inf));
                                     inf + 2
(%o11)                         log(-----------)
                                   2 (inf + 1)

Which I agree is not a great answer.  Using simpsum does the same thing.  I'm not sure if this is expected behavior in Maxima, though?

Robert Dodier

unread,
Apr 16, 2014, 3:34:25 PM4/16/14
to sage-s...@googlegroups.com
On 2014-04-16, kcrisman <kcri...@gmail.com> wrote:

> (%i11) simplify_sum(sum(log(1-1/x^2),x,2,inf));
> inf + 2
> (%o11) log(-----------)
> 2 (inf + 1)
>
> Which I agree is not a great answer. Using simpsum does the same thing.
> I'm not sure if this is expected behavior in Maxima, though?

Well, %o11 is certainly incorrect, although it is perhaps not too
surprising. simplify_sum makes use of several methods, including
Gosper's and Zeilberger's methods, which (if I recall correctly) are
applicable to indefinite finite sums (i.e., upper limit is a symbol,
say m, such that m < inf). My guess is that such a method was
applied mistakenly to %i11. Of course, that's a bug in simplify_sum.

For the record:

(%i19) simplify_sum (sum (log (1 - 1/x^2), x, 2, m));
(%o19) log((m+1)/(2*m))
(%i20) limit (%, m, inf);
(%o20) -log(2)

best,

Robert Dodier

kcrisman

unread,
Apr 16, 2014, 8:50:09 PM4/16/14
to sage-s...@googlegroups.com
Thanks, Robert.  Yes, the latter is essentially why Jori's answer works, I believe. 


- kcrisman

kcrisman

unread,
Apr 17, 2014, 2:17:20 PM4/17/14
to sage-s...@googlegroups.com
And Maxima upstream already has committed a fix, apparently - great news.  Thanks for the report! 
Reply all
Reply to author
Forward
0 new messages