ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 01 Oct 2010 22:50:10 +0200calculating multiple polylogarithms in sage/pynachttps://ask.sagemath.org/question/7716/calculating-multiple-polylogarithms-in-sagepynac/Hi Everbody
In connection with some numerical simulations I am running, I need to calculate multiple polylogarithms to high precision ( 20 digits or more). I know that there exists functions in the Ginac library that can handle this, but I would rather work in python, hence I was wondering whether similar functionality exist here. If so how do I acces it (have been looking around in the documentation, but haven't found any mention of multiple polylogs). Any help would be most welcome. Thanks!Thu, 30 Sep 2010 16:57:58 +0200https://ask.sagemath.org/question/7716/calculating-multiple-polylogarithms-in-sagepynac/Answer by burcin for <p>Hi Everbody</p>
<p>In connection with some numerical simulations I am running, I need to calculate multiple polylogarithms to high precision ( 20 digits or more). I know that there exists functions in the Ginac library that can handle this, but I would rather work in python, hence I was wondering whether similar functionality exist here. If so how do I acces it (have been looking around in the documentation, but haven't found any mention of multiple polylogs). Any help would be most welcome. Thanks!</p>
https://ask.sagemath.org/question/7716/calculating-multiple-polylogarithms-in-sagepynac/?answer=11706#post-id-11706The code for numeric evaluation of polylogarithms in GiNaC calls the CLN library directly for speed. While removing the dependency on CLN, these functions were commented out. No one has tried to get them working within pynac since.
Looking at the [relevant part of the code][1], which `kcrisman` linked to as well, you'll see that almost all numeric evaluation functions are commented out. The changes needed to get this to compile don't look too hard though. The calls to `cln::` functions need to be replaced with either the equivalent ones in [the `numeric` class][2], or use the `py_*()` functions defined in [`py_funcs.h`][3] directly.
I opened [a ticket on the Sage issue tracker (#10050)][4] to expose the polylogaritms from pynac in Sage. Fixing the numeric evaluation should be on a separate ticket.
The [getting started with pynac development][5] document might help with the first steps. Feel free to write to [the pynac-devel googlegroup][6] if you have any questions.
[1]: http://pynac.sagemath.org/hg/file/b233d9dadcfa/ginac/inifcns_nstdsums.cpp
[2]: http://pynac.sagemath.org/hg/file/b233d9dadcfa/ginac/numeric.h
[3]: http://pynac.sagemath.org/hg/file/b233d9dadcfa/ginac/py_funcs.h
[4]: http://trac.sagemath.org/sage_trac/ticket/10050
[5]: http://wiki.sagemath.org/pynac/start
[6]: http://groups.google.com/group/pynac-develFri, 01 Oct 2010 18:08:14 +0200https://ask.sagemath.org/question/7716/calculating-multiple-polylogarithms-in-sagepynac/?answer=11706#post-id-11706Comment by kcrisman for <p>The code for numeric evaluation of polylogarithms in GiNaC calls the CLN library directly for speed. While removing the dependency on CLN, these functions were commented out. No one has tried to get them working within pynac since.</p>
<p>Looking at the <a href="http://pynac.sagemath.org/hg/file/b233d9dadcfa/ginac/inifcns_nstdsums.cpp">relevant part of the code</a>, which <code>kcrisman</code> linked to as well, you'll see that almost all numeric evaluation functions are commented out. The changes needed to get this to compile don't look too hard though. The calls to <code>cln::</code> functions need to be replaced with either the equivalent ones in <a href="http://pynac.sagemath.org/hg/file/b233d9dadcfa/ginac/numeric.h">the <code>numeric</code> class</a>, or use the <code>py_*()</code> functions defined in <a href="http://pynac.sagemath.org/hg/file/b233d9dadcfa/ginac/py_funcs.h"><code>py_funcs.h</code></a> directly.</p>
<p>I opened <a href="http://trac.sagemath.org/sage_trac/ticket/10050">a ticket on the Sage issue tracker (#10050)</a> to expose the polylogaritms from pynac in Sage. Fixing the numeric evaluation should be on a separate ticket.</p>
<p>The <a href="http://wiki.sagemath.org/pynac/start">getting started with pynac development</a> document might help with the first steps. Feel free to write to <a href="http://groups.google.com/group/pynac-devel">the pynac-devel googlegroup</a> if you have any questions.</p>
https://ask.sagemath.org/question/7716/calculating-multiple-polylogarithms-in-sagepynac/?comment=22591#post-id-22591And of course we're referring to multiple polylogs here, for the original poster, though the ticket could have all of that.Fri, 01 Oct 2010 22:50:10 +0200https://ask.sagemath.org/question/7716/calculating-multiple-polylogarithms-in-sagepynac/?comment=22591#post-id-22591Answer by kcrisman for <p>Hi Everbody</p>
<p>In connection with some numerical simulations I am running, I need to calculate multiple polylogarithms to high precision ( 20 digits or more). I know that there exists functions in the Ginac library that can handle this, but I would rather work in python, hence I was wondering whether similar functionality exist here. If so how do I acces it (have been looking around in the documentation, but haven't found any mention of multiple polylogs). Any help would be most welcome. Thanks!</p>
https://ask.sagemath.org/question/7716/calculating-multiple-polylogarithms-in-sagepynac/?answer=11703#post-id-11703I think you might want to try
sage: polylog?
as a first step. But I don't see immediate Sage access to Ginac's
Li(m, x) classical polylogarithm as well as multiple polylogarithm
G(a, y) multiple polylogarithm
G(a, s, y) multiple polylogarithm with explicit signs for the imaginary parts
other than the regular polylog. However, [Pynac's code][1] doesn't seem to be missing too much of Ginac's stuff; some things are commented out, but not much.
Here is where ask.sagemath.org is NOT so helpful - no guarantee that the person who would know this best is reading. I'll ping him and see if he might give a sense of how you could write a wrapper (there are lots of good examples in Sage itself); presumably you could also access it via the C interface.
Incidentally, mpmath does not appear to currently support multiple polylogs.
[1]: http://pynac.sagemath.org/hg/file/b233d9dadcfa/ginac/inifcns_nstdsums.cpp#l1Thu, 30 Sep 2010 18:00:28 +0200https://ask.sagemath.org/question/7716/calculating-multiple-polylogarithms-in-sagepynac/?answer=11703#post-id-11703Comment by kcrisman for <p>I think you might want to try</p>
<pre><code>sage: polylog?
</code></pre>
<p>as a first step. But I don't see immediate Sage access to Ginac's</p>
<pre><code>Li(m, x) classical polylogarithm as well as multiple polylogarithm
G(a, y) multiple polylogarithm
G(a, s, y) multiple polylogarithm with explicit signs for the imaginary parts
</code></pre>
<p>other than the regular polylog. However, <a href="http://pynac.sagemath.org/hg/file/b233d9dadcfa/ginac/inifcns_nstdsums.cpp#l1">Pynac's code</a> doesn't seem to be missing too much of Ginac's stuff; some things are commented out, but not much.</p>
<p>Here is where <a href="http://ask.sagemath.org">ask.sagemath.org</a> is NOT so helpful - no guarantee that the person who would know this best is reading. I'll ping him and see if he might give a sense of how you could write a wrapper (there are lots of good examples in Sage itself); presumably you could also access it via the C interface.</p>
<p>Incidentally, mpmath does not appear to currently support multiple polylogs.</p>
https://ask.sagemath.org/question/7716/calculating-multiple-polylogarithms-in-sagepynac/?comment=22594#post-id-22594Actually, I am pretty sure you *are* talking about the different function. This is in Pynac, but I don't think this is accessed via Sage - yet.Thu, 30 Sep 2010 18:01:29 +0200https://ask.sagemath.org/question/7716/calculating-multiple-polylogarithms-in-sagepynac/?comment=22594#post-id-22594Comment by kcrisman for <p>I think you might want to try</p>
<pre><code>sage: polylog?
</code></pre>
<p>as a first step. But I don't see immediate Sage access to Ginac's</p>
<pre><code>Li(m, x) classical polylogarithm as well as multiple polylogarithm
G(a, y) multiple polylogarithm
G(a, s, y) multiple polylogarithm with explicit signs for the imaginary parts
</code></pre>
<p>other than the regular polylog. However, <a href="http://pynac.sagemath.org/hg/file/b233d9dadcfa/ginac/inifcns_nstdsums.cpp#l1">Pynac's code</a> doesn't seem to be missing too much of Ginac's stuff; some things are commented out, but not much.</p>
<p>Here is where <a href="http://ask.sagemath.org">ask.sagemath.org</a> is NOT so helpful - no guarantee that the person who would know this best is reading. I'll ping him and see if he might give a sense of how you could write a wrapper (there are lots of good examples in Sage itself); presumably you could also access it via the C interface.</p>
<p>Incidentally, mpmath does not appear to currently support multiple polylogs.</p>
https://ask.sagemath.org/question/7716/calculating-multiple-polylogarithms-in-sagepynac/?comment=22592#post-id-22592Of course :)Fri, 01 Oct 2010 11:25:12 +0200https://ask.sagemath.org/question/7716/calculating-multiple-polylogarithms-in-sagepynac/?comment=22592#post-id-22592Comment by niles for <p>I think you might want to try</p>
<pre><code>sage: polylog?
</code></pre>
<p>as a first step. But I don't see immediate Sage access to Ginac's</p>
<pre><code>Li(m, x) classical polylogarithm as well as multiple polylogarithm
G(a, y) multiple polylogarithm
G(a, s, y) multiple polylogarithm with explicit signs for the imaginary parts
</code></pre>
<p>other than the regular polylog. However, <a href="http://pynac.sagemath.org/hg/file/b233d9dadcfa/ginac/inifcns_nstdsums.cpp#l1">Pynac's code</a> doesn't seem to be missing too much of Ginac's stuff; some things are commented out, but not much.</p>
<p>Here is where <a href="http://ask.sagemath.org">ask.sagemath.org</a> is NOT so helpful - no guarantee that the person who would know this best is reading. I'll ping him and see if he might give a sense of how you could write a wrapper (there are lots of good examples in Sage itself); presumably you could also access it via the C interface.</p>
<p>Incidentally, mpmath does not appear to currently support multiple polylogs.</p>
https://ask.sagemath.org/question/7716/calculating-multiple-polylogarithms-in-sagepynac/?comment=22593#post-id-22593> "Here is where ask.sagemath.org is NOT so helpful.."
That's a possible shortcoming of sage-support too; it's just much less likely to happen there.Fri, 01 Oct 2010 08:55:00 +0200https://ask.sagemath.org/question/7716/calculating-multiple-polylogarithms-in-sagepynac/?comment=22593#post-id-22593Answer by niles for <p>Hi Everbody</p>
<p>In connection with some numerical simulations I am running, I need to calculate multiple polylogarithms to high precision ( 20 digits or more). I know that there exists functions in the Ginac library that can handle this, but I would rather work in python, hence I was wondering whether similar functionality exist here. If so how do I acces it (have been looking around in the documentation, but haven't found any mention of multiple polylogs). Any help would be most welcome. Thanks!</p>
https://ask.sagemath.org/question/7716/calculating-multiple-polylogarithms-in-sagepynac/?answer=11704#post-id-11704I'm not sure how much help this will be, but it looks to me like Sage has GiNaC built in, so there should be a way to create and manipulate GiNaC objects from Sage . . . it looks like the contents of, e.g., [`sage.functions.trig`](http://www.sagenb.org/src/functions/trig.py/) do this for some trigonometric functions; those classes are based on `GinacFunction`, from [`sage.symbolic.function`](http://www.sagenb.org/src/symbolic/function.pyx/), which looks like it might take an arbitrary GiNaC function as input . . . but maybe it only allows selected ones -- I'm not sure about that.
Good luck :)
Thu, 30 Sep 2010 18:14:22 +0200https://ask.sagemath.org/question/7716/calculating-multiple-polylogarithms-in-sagepynac/?answer=11704#post-id-11704