On Sat, Aug 30, 2008 at 4:34 PM, Ondrej Certik <[EMAIL PROTECTED]> wrote: > On Sat, Aug 30, 2008 at 6:06 AM, tkeller <[EMAIL PROTECTED]> wrote: >> >> I asked this question myself a few months ago, and the easiest 2 >> solutions seem to be utilizing sympy or maxima. >> >> Via sympy it is: >> import sympy >> sympy.var('x') >> print sympy.sum(2**(-x), (x, 1, oo)) >> >> I'm taking this from a question I posed on the sympy message list: >> http://groups.google.com/group/sympy/browse_frm/thread/5348ded3ebe8a25e?tvc=1 >> >> It should return a result of 1, but in sage 3.1.1 it returns 1-2*2**(1- >> Infinity). While technically correct, this should clearly return 1 >> when simplified so I guess there is some complication when >> transferring between modules. Ondrej will assuredly give more useful >> information if he sees this. > > sympy returns 1 for me: > > In [1]: sum(2**(-x), (x, 1, oo)) > Out[1]: 1 > > >> >> More specifically , your example using m=2 is: >> sympy.sum(1/((x+2)**3)),(x,1,oo)) >> >> Unfortunately this returns >> Sum((2 + x)**(-3), (x, 1, Infinity)) > > In [4]: sum(1/(x+2)**3,(x,1,oo)) > Out[4]: Sum((2 + x)**(-3), (x, 1, oo)) > > Thanks for the spot, I reported it: > > http://code.google.com/p/sympy/issues/detail?id=1066 > >> >> n() on this function does not work, maybe a sympy equivalent would? >> It may work better with a %python header, though I haven't tested this >> yet (if you use the notebook). > > It does work in sympy: > > In [5]: N(sum(1/(x+2)**3,(x,1,oo))) > Out[5]: 0.0770569031595943
Here is how you can get the result using sympy's nsimplify, if you know the result should contain zeta(3): In [35]: e = sum(1/(x+2)**3,(x,1,oo)) In [36]: nsimplify(e, [zeta(3)]) Out[36]: -9/8 + ΞΆ(3) nsimplify takes the floating point approximation of the result (by default currently at least 30 digits) and tries to get the same results using a simple formula. See nsimiplify??. You need the latest hg version of sympy, this is quite recent code. Ondrej --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---