Ask Your Question

Revision history [back]

Exponent Overflow error in PolynomialRing()

Let $R = \mathbb{F}_{71}[x, y]$ be a polynomial ring over the finite field of $p = 71$ elements and let $f = x^7 + y^5 \in R$ be a polynomial. I need to compute powers of $f$ of the form $f^{p^e - 1}$ where $e \geq 1$ is an integer, that is, the polynomials $$f^{70}, f^{5\hspace{1pt}040}, f^{357\hspace{1pt}910}, f^{25\hspace{1pt}411\hspace{1pt}680}, \ldots.$$ Here is my code:

from sage.all import *
from sage.arith.power import generic_power

p = 71
R = PolynomialRing(GF(p), 'X, Y')
X, Y = R.gens()
f = X**7 + Y**5

for e in range(1, 10):
    exponent = p**e - 1
    print(generic_power(f, exponent))

However, I quickly into an exponent overflow error when computing $f^{357\hspace{1pt}910}$. Here is the log:

Traceback (most recent call last):
  File "/home/root/test.py", line 12, in <module>
    print(f**exponent)
  File "sage/rings/polynomial/multi_polynomial_libsingular.pyx", line 2467, in sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular.__pow__ (build/cythonized/sage/rings/polynomial/multi_polynomial_libsingular.cpp:23225)
  File "sage/libs/singular/polynomial.pyx", line 385, in sage.libs.singular.polynomial.singular_polynomial_pow (build/cythonized/sage/libs/singular/polynomial.cpp:5214)
  File "sage/libs/singular/singular.pyx", line 1496, in sage.libs.singular.singular.overflow_check (build/cythonized/sage/libs/singular/singular.cpp:12737)
OverflowError: exponent overflow (2505370)

Based on the logs, it seems like sage uses Singular libraries to compute the powers of $f$. Is it possible to change the maximum exponent allowed by Singular?