[sage-devel] Re: Bug in pickling of callable symbolic functions
On Sunday, May 3, 2015 at 3:45:26 PM UTC+2, Eric Gourgoulhon wrote: G(a, y)multiple polylogarithm G(a, s, y)multiple polylogarithm with explicit signs for the imaginary parts S(n, p, x)Nielsen’s generalized polylogarithm H(m, x)harmonic polylogarithm Thanks for your answer and the link! This is clearly the source of the problem. The code for these functions was commented out in Pynac (and incorrectly so), and so they were dysfunctional for quite some time already, only existing in the registry. I just removed them. The only thing that could happen are pickles from the time they were still accessible from Sage (which I doubt they were). The changes will appear in pynac-0.4.1. Regards, -- You received this message because you are subscribed to the Google Groups sage-devel group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Re: Bug in pickling of callable symbolic functions
Hi, Le vendredi 1 mai 2015 17:23:55 UTC+2, Nils Bruin a écrit : On Friday, May 1, 2015 at 2:00:11 AM UTC-7, Eric Gourgoulhon wrote: Thanks for your answer. There is no predefined 'H' function in Sage, so do you mean a nameclash with a predefined function 'H' in Pynac ? Which function is it ? It seems to be (x,y) |-- - x ln(1-xy), but I don't see why this function is special and would deserve a predefined name. Most probably these (from http://www.ginac.de/tutorial/#Built_002din-functions ): G(a, y)multiple polylogarithm G(a, s, y)multiple polylogarithm with explicit signs for the imaginary parts S(n, p, x)Nielsen’s generalized polylogarithm H(m, x)harmonic polylogarithm Thanks for your answer and the link! This is clearly the source of the problem. This is clearly a problem in sage: we're not exposing these polylogs under those names at all, and even for sin we do seem to support having new, symbolic, user functions with that name (which will collide as soon as you step into libmaxima or anything else that has to communicate function identifiers by names in a flat namespace). The fact that we don't in pickling is clearly a problem. A workaround until something better could be to modify Sage's function(s, *args, **kwds) to generate an error (e.g. this name is reserved) as soon as - s = 'sin' or any predefined Sage function - s='G' and len(args)=2 or 3 - s='H' and len(args)=2 - s='S' and len(args)=3 etc. But this might be tedious, given the large number of functions in Sage... Eric. -- You received this message because you are subscribed to the Google Groups sage-devel group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Re: Bug in pickling of callable symbolic functions
On Friday, May 1, 2015 at 5:23:55 PM UTC+2, Nils Bruin wrote: We're entirely at the mercy of the care that Pynac takes to preserve compatibility to ensure our pickles won't break on future versions (and I don't know if such compatibility is a design goal for them). With python pickling, we have plenty examples where compatibility across major changes was preserved. OTOH Pynac is not required to follow any changes happening upstream. Unfortunately I haven't dealt with the pickling code so far, but at least there is now a ticket for the problem: https://github.com/pynac/pynac/issues/29 Your last message was chopped off. What did you want to say? -- You received this message because you are subscribed to the Google Groups sage-devel group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Re: Bug in pickling of callable symbolic functions
On Thursday, April 30, 2015 at 2:30:48 AM UTC-7, Eric Gourgoulhon wrote: Hi, I've recently faced this surprising appearance of a logarithm (in Sage 6.7.beta3 as well as in any older versions I've tried, down to Sage 6.3): The exact source of these name collisions are probably explained on http://www.ginac.de/tutorial/#Built_002din-functions particularly: ... G(a, y)multiple polylogarithm G(a, s, y)multiple polylogarithm with explicit signs for the imaginary parts S(n, p, x)Nielsen’s generalized polylogarithm H(m, x)harmonic polylogarithm ... The proper solution is probably to significantly -- You received this message because you are subscribed to the Google Groups sage-devel group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Re: Bug in pickling of callable symbolic functions
On Friday, May 1, 2015 at 2:00:11 AM UTC-7, Eric Gourgoulhon wrote: Thanks for your answer. There is no predefined 'H' function in Sage, so do you mean a nameclash with a predefined function 'H' in Pynac ? Which function is it ? It seems to be (x,y) |-- - x ln(1-xy), but I don't see why this function is special and would deserve a predefined name. Most probably these (from http://www.ginac.de/tutorial/#Built_002din-functions ): G(a, y)multiple polylogarithm G(a, s, y)multiple polylogarithm with explicit signs for the imaginary parts S(n, p, x)Nielsen’s generalized polylogarithm H(m, x)harmonic polylogarithm This is clearly a problem in sage: we're not exposing these polylogs under those names at all, and even for sin we do seem to support having new, symbolic, user functions with that name (which will collide as soon as you step into libmaxima or anything else that has to communicate function identifiers by names in a flat namespace). The fact that we don't in pickling is clearly a problem. In order to change it we'd need to either change ginac's serialization (remove the assumption that functions can be identified by their name) or change to a serialization process that stays closer to python's pickling protocol. This would be more future-proof: symbolic pickling at the moment is very opaque: sage: explain_pickle(dumps(sin(x))) pg_Expression = unpickle_global('sage.symbolic.expression', 'Expression') si = unpickle_newobj(pg_Expression, ()) unpickle_build(si, (0r, ['x'], 'GARC\x03\tfunction\x00class\x00symbol\x00x\x00name\x00seq\x00python\x00sin\x00sage_ex\x00\x01\x08\x01\x02\x02\n\x02\x03\x04\n\x00+\x001\x00\x07')) si We're entirely at the mercy of the care that Pynac takes to preserve compatibility to ensure our pickles won't break on future versions (and I don't know if such compatibility is a design goal for them). With python pickling, we have plenty examples where compatibility across major changes was preserved. -- You received this message because you are subscribed to the Google Groups sage-devel group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Re: Bug in pickling of callable symbolic functions
Hi, Le jeudi 30 avril 2015 17:44:39 UTC+2, Nils Bruin a écrit : This is probably just a nameclash, since pickling symbolic expressions. Pickling symbolic expressions rather directly depends on pynac's serialization, so we're restricted by the limitations that has. Thanks for your answer. There is no predefined 'H' function in Sage, so do you mean a nameclash with a predefined function 'H' in Pynac ? Which function is it ? It seems to be (x,y) |-- - x ln(1-xy), but I don't see why this function is special and would deserve a predefined name... In any case, the symbolic function 'H' has to have two arguments (so it excludes the Heaviside function), because with a single one or three of them, it is OK. Changing the names of the arguments does not help: loads(dumps(function('H', u, v))) still returns -u*log(-u*v + 1). Note the following: sage: function('sin')(x).diff() D[0](sin)(x) sage: loads(dumps(function('sin')(x))).diff() cos(x) As you can see, pickling a fresh symbolic function that happens to clash with an existing one doesn't work properly. Thanks for this example. It's clear that naming a fresh function 'sin' may lead to some trouble. However, as mentionned above, I don't see the problem with 'H' (nor 'G')... Eric. -- You received this message because you are subscribed to the Google Groups sage-devel group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Re: Bug in pickling of callable symbolic functions
On Thursday, April 30, 2015 at 2:30:48 AM UTC-7, Eric Gourgoulhon wrote: Hi, I've recently faced this surprising appearance of a logarithm (in Sage 6.7.beta3 as well as in any older versions I've tried, down to Sage 6.3): sage: var('y') y sage: f = function('H', x, y); f H(x, y) sage: loads(dumps(f)) -x*log(-x*y + 1) This is probably just a nameclash, since pickling symbolic expressions. Pickling symbolic expressions rather directly depends on pynac's serialization, so we're restricted by the limitations that has. Note the following: sage: function('sin')(x).diff() D[0](sin)(x) sage: loads(dumps(function('sin')(x))).diff() cos(x) As you can see, pickling a fresh symbolic function that happens to clash with an existing one doesn't work properly. My guess is that the segfaults are probably triggered by some violated assumptions subsequently. -- You received this message because you are subscribed to the Google Groups sage-devel group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.