Sorry, this content is no longer available

Ask Your Question
0

Exponent Overflow error in PolynomialRing()

asked 1 year ago

Let R=F71[x,y] be a polynomial ring over the finite field of p=71 elements and let f=x7+y5R be a polynomial. I need to compute powers of f of the form fpe1 where e1 is an integer, that is, the polynomials f70,f5040,f357910,f25411680,.

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 f357910. 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?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 1 year ago

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.

Preview: (hide)
link

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: 1 year ago

Seen: 216 times

Last updated: Mar 06 '24