[sage-devel] Re: coercion of objects embedded in symbolic expressions
On Sunday, February 22, 2015 at 1:03:54 PM UTC+1, Burcin Erocal wrote: Pynac already calls the Python comparison function if both are pyobjects. In this case, infinity and constants are not pyobjects. They are a basic class as in mul, add, symbol, etc. The code need not be fast so my solution is in Python and utilizes the InfinityRing. http://trac.sagemath.org/ticket/12967 -- 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: coercion of objects embedded in symbolic expressions
On Sun, 22 Feb 2015 03:17:13 -0800 (PST) Volker Braun vbraun.n...@gmail.com wrote: Just to tell you what you already know, the symbolic ring is the parent of last resort if there is nothing more specific. So its to be expected that you don't have any canonical maps elsewhere. Pynac should probably unwind the comparison of two wrapped (non-symbolic) python objects to the comparison of the underlying python objects. Haven't tried that, though. You have to be careful about infinite recursions, the comparison might again coerce into the symbolic ring. Pynac already calls the Python comparison function if both are pyobjects. In this case, infinity and constants are not pyobjects. They are a basic class as in mul, add, symbol, etc. Cheers, Burcin P.S. The infinity class was added to pynac by Volker. :) On Sunday, February 22, 2015 at 11:02:44 AM UTC+1, Ralf Stephan wrote: Hello, a long standing issue is sage: bool(piInfinity) False sage: bool(SR(3)Infinity) False http://trac.sagemath.org/ticket/12967 at which I'm having a naive stab (because it interferes with #14801). Maybe I can learn something? In the ticket the problem has been said having to do with Pynac, but I don't think so. It would all work nicely if, instead of the expression object, its underlying `pyobject` would be compared. But this does not happen because there is no coerce map from `SR` to `InfinityRing`. So, can we somehow have an indirect coercion map that uses not the parent but the parent of something a member function (like `pyobject`) returns? The problem of SR having no canonical map to anything in spite of some expressions being well behaved is the source of much frustration. 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: coercion of objects embedded in symbolic expressions
Just to tell you what you already know, the symbolic ring is the parent of last resort if there is nothing more specific. So its to be expected that you don't have any canonical maps elsewhere. Pynac should probably unwind the comparison of two wrapped (non-symbolic) python objects to the comparison of the underlying python objects. Haven't tried that, though. You have to be careful about infinite recursions, the comparison might again coerce into the symbolic ring. On Sunday, February 22, 2015 at 11:02:44 AM UTC+1, Ralf Stephan wrote: Hello, a long standing issue is sage: bool(piInfinity) False sage: bool(SR(3)Infinity) False http://trac.sagemath.org/ticket/12967 at which I'm having a naive stab (because it interferes with #14801). Maybe I can learn something? In the ticket the problem has been said having to do with Pynac, but I don't think so. It would all work nicely if, instead of the expression object, its underlying `pyobject` would be compared. But this does not happen because there is no coerce map from `SR` to `InfinityRing`. So, can we somehow have an indirect coercion map that uses not the parent but the parent of something a member function (like `pyobject`) returns? The problem of SR having no canonical map to anything in spite of some expressions being well behaved is the source of much frustration. 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: coercion of objects embedded in symbolic expressions
Hi, Just to tell that no later than two days ago, I had a bug in my code that was caused by bool(SR(0) Infinity) returning False. I was about to post a message to sage-devel, but thanks to your post, I realize this is a known issue. Best wishes, 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.