Ask Your Question

Revision history [back]

I came across a similar error in the version of Sage 10.4 while computing

(1 - x^38)^9223372036854775808

It "feels" similare because the line of code which generates the error is the same (x = g_pow(self._gobj, nexp._gobj)). While the RuntimeError I get seems now undocumented (no description after "RuntimeError:"), the fact that 9223372036854775808 is 2^63 calls for a signed long size error.

I read the comment about the size of memory involved, and I think it is not the case: it really seems that the library sage is using relies on signed long, rather than switching to arbitrary large integers.

Is there something which can be done to bypass this limitation while using the same library of Sage? (or some other way within Sage to succeed in this computation?)

Thank you very much for your help.


This is the error I get:

    RuntimeError                              Traceback (most recent call last)
Cell In[1], line 1
----> 1 (Integer(1) - x**Integer(38))**Integer(9989690752182277136)

File /ext/sage/10.4/src/sage/structure/element.pyx:2058, in sage.structure.element.Element.__pow__()
   2056     return (<Element>left)._pow_(right)
   2057 if BOTH_ARE_ELEMENT(cl):
-> 2058     return coercion_model.bin_op(left, right, pow)
   2059 
   2060 cdef long value

File /ext/sage/10.4/src/sage/structure/coerce.pyx:1228, in sage.structure.coerce.CoercionModel.bin_op()
   1226         return (<Action>action)._act_(x, y)
   1227     else:
-> 1228         return (<Action>action)._act_(y, x)
   1229 
   1230 # Now coerce to a common parent and do the operation there

File /ext/sage/10.4/src/sage/structure/coerce_actions.pyx:931, in sage.structure.coerce_actions.IntegerPowAction._act_()
    929     if not err:
    930         return e._pow_long(value)
--> 931     return e._pow_int(n)
    932 
    933 def _repr_name_(self):

File /ext/sage/10.4/src/sage/symbolic/expression.pyx:4530, in sage.symbolic.expression.Expression._pow_int()
   4528         pi^4
   4529     """
-> 4530     return self._pow_(self._parent(other))
   4531 
   4532 def derivative(self, *args):

File /ext/sage/10.4/src/sage/symbolic/expression.pyx:4514, in sage.symbolic.expression.Expression._pow_()
   4512                    relational_operator(self._gobj))
   4513 else:
-> 4514     x = g_pow(self._gobj, nexp._gobj)
   4515 return new_Expression_from_GEx(self._parent, x)
   4516 

RuntimeError: