The computation in pari (directed from Sage):

sage: x=pari("x")
sage: y=pari("y")
sage: sqrt3=pari("Mod")(x, x^2-3)
sage: sqrt5=pari("Mod")(y, y^2-5)
sage: a1=pari("a1")
sage: a2=pari("a2")
sage: a3=pari("a3")
sage: a4=pari("a4")
sage: a5=pari("a5")
sage: time f = (a1+a2+a3+sqrt5*a4+sqrt3*a5)**18
CPU times: user 148 ms, sys: 0 ns, total: 148 ms
Wall time: 146 ms
sage: len(str(f).split("+"))
7315

But in pari, it is not very elegant to see as there is no real support
for polynomials over several variables.

My conclusion is that generic polynomials in Sage are very slow!

Vincent

2015-01-19 19:53 UTC+01:00, William Stein <wst...@gmail.com>:
> On Mon, Jan 19, 2015 at 10:47 AM, Nils Bruin <nbr...@sfu.ca> wrote:
>>> Nils, did you specifically try this **exact input**??
>>
>>
>> Full session:
>>
>> sage: sage: K.<sqrt3> = QuadraticField(3)
>> sage: sage: R.<a1,a2,a3,a4,a5> = K[]
>> sage: sage: timeit("(a1+a2+a3+a4+sqrt3*a5)^25")
>> 5 loops, best of 3: 79.9 ms per loop
>> sage: sage: timeit("ex=(a1+a2+a3+a4+sqrt3*a5)^25")
>> 5 loops, best of 3: 80.4 ms per loop
>> sage: sage: timeit("ex=expand((a1+a2+a3+a4+sqrt3*a5)^25)")
>> 5 loops, best of 3: 80.5 ms per loop
>> sage: sage: timeit("expand((a1+a2+a3+a4+sqrt3*a5)^25)")
>> 5 loops, best of 3: 79.6 ms per loop
>>
>> version:
>
> Thanks.  I tried again and found that
>
>    timeit("ex=expand((a1+a2+a3+a4+sqrt3*a5)^25)")
>
> is (of course) the same speed as
>
>    timeit("(a1+a2+a3+a4+sqrt3*a5)^25")
>
> in my tests.    (I was in a spouse-induced hurry before.)
>
> William
>
>>
>> commit b1287e75962a2dc590f1fa22acc90a4e53383aab
>> Merge: 99ec4cc 106f5d4
>> Author: Jeroen Demeyer
>> Date:   Mon Jan 12 13:51:07 2015 +0100
>>
>>     Merge branch 'ticket/17561' into ticket/10513
>>
>>     Conflicts:
>>         src/sage/modules/free_module_element.pyx
>>
>> commit 106f5d41398794b13a6a683236cf219d49602312
>> Author: Jeroen Demeyer
>> Date:   Sat Jan 3 11:04:51 2015 +0100
>>
>>     Minor improvements in FreeModuleElement_generic_sparse.__init__
>>
>> commit 99ec4cc13099658e0bc762a6e8d230c3956c7150
>> Author: Peter Bruin
>> Date:   Sat Jan 3 09:40:54 2015 +0100
>>
>>     Trac 10513: revert a change in try...except
>>
>> commit df0fb69e1aa9ab205e35b98ad6d97d0c67b889af
>> Author: Jeroen Demeyer
>> Date:   Mon Dec 29 09:19:24 2014 +0100
>>
>>     Declare types of _entries
>>
>> commit 5bf671225b38a8efd55a662a8c967767ac85c7db
>> Author: Volker Braun
>> Date:   Sun Dec 21 22:47:26 2014 +0100
>>
>>     Updated Sage version to 6.5.beta4
>>
>> --
>> 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.
>
>
>
> --
> William Stein
> Professor of Mathematics
> University of Washington
> http://wstein.org
>
> --
> 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.
>

-- 
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