infinite sums?

55 views
Skip to first unread message

tkeller

unread,
Jun 25, 2008, 7:47:19 PM6/25/08
to sympy
Hi folks,
Thanks for this excellent implementation of symbolic algebra in
python. I'm trying to compute some infinite sums, but haven't seen
any clear examples of how this is done. I googled one page that
states an implementation of this by mpmath, but don't know how to
access that from within sympy. Would it be easiest for me to just
directly install mpmath?

Regards,
Thomas Keller

Ondrej Certik

unread,
Jun 26, 2008, 3:27:24 AM6/26/08
to sy...@googlegroups.com

Hi Thomas,

thanks for your interest. Whenever there is something not in our
documentation, but you suspect sympy can do, try to look into tests
(all functionality is tested for, or at least should be). In this
particular case, look into:

http://hg.sympy.org/sympy/file/9b08e6f28e3e/sympy/concrete/tests/test_sums_products.py

You'll find there plenty of examples, e.g.:

In [1]: var("n")
Out[1]: n

In [2]: sum(2**(-n), (n, 1, oo))
Out[2]: 1

In [3]: sum(2**(-4*n+3), (n, 1, oo))
Out[3]: 8/15

If you discover some sums, that are not working, you can try to look
how it is implemented and maybe try to figure out how to fix it. We'll
help you prepare any patches.

As to your question about mpmath, you can access mpmath easily from sympy:

from sympy.thirdparty import mpmath

Let us ask, if you have more quesitons.

Ondrej

tkeller

unread,
Jun 27, 2008, 8:57:55 PM6/27/08
to sympy
Sorry for the late reply,
This is great, and thanks much for the prompt response. I look forward
to your progress!
TK

On Jun 26, 2:27 am, "Ondrej Certik" <ond...@certik.cz> wrote:
> On Thu, Jun 26, 2008 at 1:47 AM, tkeller <Thomas.E.Kel...@gmail.com> wrote:
>
> > Hi folks,
> > Thanks for this excellent implementation of symbolic algebra in
> > python.  I'm trying to compute some infinite sums, but haven't seen
> > any clear examples of how this is done.  I googled one page that
> > states an implementation of this by mpmath, but don't know how to
> > access that from within sympy.  Would it be easiest for me to just
> > directly install mpmath?
>
> Hi Thomas,
>
> thanks for your interest. Whenever there is something not in our
> documentation, but you suspect sympy can do, try to look into tests
> (all functionality is tested for, or at least should be). In this
> particular case, look into:
>
> http://hg.sympy.org/sympy/file/9b08e6f28e3e/sympy/concrete/tests/test...
Reply all
Reply to author
Forward
0 new messages