On May 21, 2010, at 2:53 PM, Alex P wrote:

Hi all,
I tried the following code in SAGE and it seems that it is taking way
too long

----------------------------------------------------------------------
| Sage Version 4.3.4, Release Date: 2010-03-19                       |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
sage: q = 5
sage: F = FiniteField(q)
sage: P.<T> = PolynomialRing(F)
sage: PP.<z> = PolynomialRing(P)
sage: UU.<X> = PolynomialRing(PP)
sage: pro = X - 1/z
sage: for p in P.monics(of_degree = 1):
  ...:     time pro = pro*(X - p^q/(z + z^q))
  ...:
CPU times: user 0.05 s, sys: 0.00 s, total: 0.05 s
Wall time: 0.15 s
CPU times: user 0.39 s, sys: 0.00 s, total: 0.39 s
Wall time: 0.39 s
CPU times: user 2.56 s, sys: 0.00 s, total: 2.56 s
Wall time: 2.57 s
CPU times: user 16.53 s, sys: 0.02 s, total: 16.55 s
Wall time: 16.58 s
CPU times: user 139.67 s, sys: 0.32 s, total: 139.99 s
Wall time: 141.16 s


Even worse if I try to continue the calculations in degree 2 it is
already taking over 10 min (and counting). Is this normal? And if so
is there a way to avoid this?

Try working a multivariate ring rather than a tower of univariate rings, e.g.

sage: q = 5
sage: F = GF(q)
sage: P.<T,z,X> = F[]
sage: pro = X - 1/z

sage: def monics(n):
....:    powers = [T^i for i in range(n)]
....:    for v in F^n:
....:        yield T^n + sum(c*Tk for c,Tk in zip(v, powers))
....:


sage: for p in monics(1):
....:     time pro = pro*(X-p^q / (z+z^q))
....:
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 0.04 s
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 0.00 s
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 0.00 s
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 0.00 s
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 0.00 s

sage: pro = X - 1/z
sage: for p in monics(2):
....:     time pro = pro*(X-p^q / (z+z^q))
....:
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 0.00 s
[...]
CPU times: user 0.01 s, sys: 0.00 s, total: 0.01 s
Wall time: 0.01 s

sage: time for p in monics(2): pro = pro*(X-p^q / (z+z^q))
CPU times: user 0.05 s, sys: 0.00 s, total: 0.05 s
Wall time: 0.05 s

- Robert

--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to