Hi,

It is not related to exponentiation; it is due to the difference between
symbolic evaluation and real-valued evaluation when dividing by zero.

Real-valued arithmetic mirrors the IEEE floating point standard, I expect:

sage: 1.0/0
+infinity

While symbolic evaluation gives the divide-by-zero error:

sage: expr = 1.0/x
sage: expr(x=0)
<BOOM>
Traceback (most recent call last)
...
ValueError: power::eval(): division by zero

Note that the inline-function-notation "p(n) = ..." is really just
defining a symbolic expression. In the above snippet I rely on x being a
symbolic variable in a fresh Sage instance, thereby avoiding writing
"expr(x) = ...".

I don't have a better explanation for why this difference has been
adopted in Sage than the above: following IEEE standard vs doing the
mathematically safe-and-fail-early-solution. Perhaps someone more
knowledgeable about this can chime in.

Best,
Johan


Andrey Novoseltsev writes:

> On Fri, Mar 16, 2018 at 4:18 PM, Jorge Garcia <calcp...@gmail.com> wrote:
>> Dear Hive Mind:
>>
>> Why is there no Divide By Zero Error here:
>> http://sagecell.sagemath.org/?z=eJwljkELgkAUhO-C_2GiAtek1kuX2Eu4pBc3NjEqCqQ2E-QlpvX3cwuGd5jHzDdjZHGyw6BUZdgoFQXYx1JLa2WxRJTkSSSxPuAotYLUWumR64zRcDEJOecBtFhOA3QitHZpyLRFZ1BR03fDvdb9raISJLjrpKItqDReyNnq9Xh-vJTZkHkXdW9DjUcMvu__F2SIlNxhk-Tyt-UHH76usxUny_a9cMbnfLkgdiHcny1oICI9_8u37AuZcDtw&lang=sage
>>
>> But there is a Divide By Zero Error here (as expected):
>> http://sagecell.sagemath.org/?z=eJwlj0FLw0AQhe-B_IcnVcimQTeXXmQPtRnsXrJhG6q2WAh2GwtlGmKif9_dBoY5zJvvzZsZ6rXewNerMUWGNwK9V7SqsUSht7ogvHxgR9aArDX2Lo5m6KS6z6WUGaxaPGQYVB5HXcJChWma5HP5KBdPLA78_PN9_UuCJgLZOnZ9MzicuRsH378u4_HMLVjJOCpV33DrklyKiStvkPttLmOAgg3SNF2TJegahSGfW2_JP0FTPq_GUaX2t9XTtQf7Iyg_J79K_AMYbUA7&lang=sage
>>
>> Can someone please explain this to me? This came up in class and I was
>> looking for a "teachable moment" asking the students to fix the Divide By
>> Zero Error like this:
>> http://sagecell.sagemath.org/?z=eJwljkFrg0AUhO-C_2GKKbhW0t1LLmUvwddmLxq2EtKWBKTZWkGeYjX5-3XjbXgz37yJkJmDyQjbD3ySLUDWFhav5kjZQxhE6KVeKSllCqs3jylGrcKgj1lof01i9STXcvPM4swvf7_dLfae8GTt2A3V6NBwP43Ii3JW3-10abgGaxkGuR4qrl2sUiXFQud31F2rdvKoL0OSJDuyBFMiK-gdb-ZAKHe0bJ3dMNjrr3v0pxvA8xvkp6VvL_4B6uc8qg==&lang=sage
>>
>> Thanx,
>> AJG
>
> Someone probably can, but perhaps not on this list: it has something
> to do with 0^0 evaluating to 1 and I recall some earlier discussions
> about it. Forwarding to sage-support.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to