Hi Miguel,

On Mon, Jan 19, 2015 at 4:03 PM, mmarco <mma...@unizar.es> wrote:
> It is much faster to work with absolute fields instead of towers of
> extensions:
>
> sage: K.<sqrt3>=QuadraticField(3)
> sage: F.<sqrt5>=K.extension(x^2-5)
> sage: R.<a1,a2,a3,a4,a5> = F[]
> sage: %time _=(a1+a2+a3+sqrt5*a4+sqrt3*a5)^25
> CPU times: user 27.4 s, sys: 12 ms, total: 27.4 s
> Wall time: 27.5 s
> sage: FF.<a>=F.absolute_field()
> sage: fsqrt3=FF(F(sqrt3))
> sage: fsqrt5=FF(sqrt5)
> sage: RR.<a1,a2,a3,a4,a5> = FF[]
> sage: %time _=(a1+a2+a3+fsqrt5*a4+fsqrt3*a5)^25
> CPU times: user 1.26 s, sys: 3 ms, total: 1.27 s
> Wall time: 1.27 s

Thanks. I tried it on SMC:

sage: K.<sqrt3>=QuadraticField(3)
sage: F.<sqrt5>=K.extension(x^2-5)
sage: R.<a1,a2,a3,a4,a5> = F[]
sage: %time _=(a1+a2+a3+sqrt5*a4+sqrt3*a5)^18
CPU times: user 2.76 s, sys: 12.5 ms, total: 2.77 s
Wall time: 2.77 s
sage: len(str(_).split("+"))
7315
sage: FF.<a>=F.absolute_field()
sage: fsqrt3=FF(F(sqrt3))
sage: fsqrt5=FF(sqrt5)
sage: RR.<a1,a2,a3,a4,a5> = FF[]
sage: %time _=(a1+a2+a3+fsqrt5*a4+fsqrt3*a5)^18
CPU times: user 320 ms, sys: 0 ns, total: 320 ms
Wall time: 320 ms
sage: len(str(_).split("+"))
12430

and your approach returns a wrong number of terms, so something is
wrong. But it is quite fast.

Ondrej

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to