sage: sum?
I get told to use it the following way:
sage: sum(expression, k, 1, n)
which should give me back the summation of "expression" over the index
k from 1 to n.
Unfortunately this gives me an error message like "summation index
needed".
I found out searching the internet that writing instead:
sum(expression for k in (1..n))
works. So I'm assuming that the documentation is outdated. Maybe this
is well know, but I hope it is ok to post this here.
Cheers
Michael
>
> > So I'm assuming that the documentation is outdated. Maybe this
> > is well know, but I hope it is ok to post this here.
>
> Could you try the examples in the documentation at [1] and see if it's
> what you wanted?
>
> [1]http://www.sagemath.org/doc/reference/sage/misc/functional.html#sage....
>
> --
> Regards
> Minh Van Nguyen
Great!
I have seen in the documentation of [1], and I have seen the notation
sum(1/k^4, k, 1, oo) that is also new for me.
But I want to make a comment, also from this documentation. It says
sum(1/(1+k^2), k, -oo, oo, algorithm = 'mathematica') # optional
-- requires mathematica
OK, I understand that sage do not kown how to evaluate
sum(1/(1+k^2), k, -oo, oo)
But it answer 0 , that is wrong!!!
(I have yet 4.3.1; I'm waiting 4.3.4 to update my sage)
Yours,
Juan Luis Varona
>
> > OK, I understand that sage do not kown how to evaluate
> > sum(1/(1+k^2), k, -oo, oo)
>
> > But it answer 0 , that is wrong!!!
>
> Both Sage 4.3.3 and 4.3.4 give the same wrong answer:
>
> [mvngu@sage sage-4.3.4]$ sage
> ----------------------------------------------------------------------
> | Sage Version 4.3.3, Release Date: 2010-02-21 |
> | Type notebook() for the GUI, and license() for information. |
> ----------------------------------------------------------------------
> sage: k = var("k")
> sage: sum(1/(1+k^2), k, -oo, oo)
> 0
>
> [mvngu@sage sage-4.3.4]$ ./sage
> ----------------------------------------------------------------------
> | Sage Version 4.3.4, Release Date: 2010-03-19 |
> | Type notebook() for the GUI, and license() for information. |
> ----------------------------------------------------------------------
> sage: k = var("k")
> sage: sum(1/(1+k^2), k, -oo, oo)
> 0
>
> Here is the answer from Maple:
>
> [mvngu@sage ~]$ maple
> |\^/| Maple 12 (X86 64 LINUX)
> ._|\| |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2008
> \ MAPLE / All rights reserved. Maple is a trademark of
> <____ ____> Waterloo Maple Inc.
> | Type ? for help.> sum(1 / (1 + k^2), k=-infinity..infinity);
>
> Pi coth(Pi)
>
> And the answer from Mathematica:
>
> [mvngu@sage ~]$ math
> Mathematica 6.0 for Linux x86 (64-bit)
> Copyright 1988-2007 Wolfram Research, Inc.
>
> In[1]:= Sum[1 / (1 + k^2), {k, -Infinity, Infinty}]
>
> I
> Out[1]= - (PolyGamma[0, -I - Infinty] - PolyGamma[0, I - Infinty])
> 2
>
> > (I have yet 4.3.1; I'm waiting 4.3.4 to update my sage)
>
> Unfortunately, updating to Sage 4.3.4 won't even fix the above issue
> with the sum() command. The above issue with the sum() command is now
> tracked at ticket #8582:
>
> http://trac.sagemath.org/sage_trac/ticket/8582
>
Thanks for include it as a ticket.
Juan Luis
PD: Mathematica 7.0 also gives the correct answer Pi Coth[Pi]]