1 | initial version |

Here is another case:

```
sage: GF(7)(0)^0
---------------------------------------------------------------------------
ArithmeticError Traceback (most recent call last)
/home/jsrn/local/sage/<ipython console> in <module>()
/home/jsrn/local/sage/sage-4.5.3/local/lib/python2.6/site-packages/sage/rings/finite_rings/integer_mod.so in sage.rings.finite_rings.integer_mod.IntegerMod_int.__pow__ (sage/rings/finite_rings/integer_mod.c:16942)()
ArithmeticError: 0^0 is undefined.
```

The same goes for polynomial rings over fields: `GF(7)[x](0)^0`

.

I think that the primary thing is for Sage to be consistent; as you hinted at, I would think that the following invariants should always hold:

```
a^x == a**x == pow(a,x)
```

and

```
a^x mod n == pow(a,x,n) == power_mod(a,x,n)
```

For all rings in which they make sense. The 0^0 case is sometimes convenient to define to 1, sometimes 0 and sometimes NaN, so I would think that always giving an error is sensible. It is kind of annoying to often have to work around in general formulas, but on the other hand, in each of these cases, Sage will force you to consider the behaviour that makes mathematical sense for you; otherwise, you might miss rare cases of errors. As an alternative, some sort of global setting (or ring-specific setting) might be added, so one could set the value.

The behaviour of `simplify`

is another discussion, I guess. There, it might prove _very_ annoying to not simplify `0^some_expr`

, but then again, I do like consistency.

Maybe this should be taken to sage_devel; maybe it has already been there? Sorry for the discussion-like quality of the answer.

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.