Ask Your Question
0

Exponent Overflow error in PolynomialRing()

asked 2024-03-06 17:18:27 +0100

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2024-03-06 22:44:14 +0100

Max Alekseyev gravatar image

The size of powers grows exponentially, so before computing it's worth checking whether it'd be possible to accommodate the result in memory. As for your specific powers p**e - 1, you can compute first f**(p**e) by iterative raising to power p, and then divide the result by f:

f = X**7 + Y**5
g = f
for e in range(1, 10):
    g **= p
    print( e, g//f )

However, be prepared that this computation will die after first few values due to enormous and ever growing size of the result.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2024-03-06 17:18:27 +0100

Seen: 187 times

Last updated: Mar 06