Hello Ondrej,

For such questions of Sage usage, it is better to discuss on
ask.sagemath.org or sage-support.

You can also deal with all algebraic numbers at once with QQbar

sage: sqrt3 = QQbar(sqrt(3))
sage: sqrt5 = QQbar(sqrt(5))

But then polynomials over QQbar are much slower.

Vincent

2015-01-19 19:24 UTC+01:00, Ondřej Čertík <ondrej.cer...@gmail.com>:
> On Mon, Jan 19, 2015 at 11:19 AM, Ondřej Čertík <ondrej.cer...@gmail.com>
> wrote:
>> Hi Vincent,
>>
>> On Sun, Jan 18, 2015 at 10:06 AM, Vincent Delecroix
>> <20100.delecr...@gmail.com> wrote:
>>> Hi,
>>>
>>> 2015-01-18 18:03 UTC+01:00, Ondřej Čertík <ondrej.cer...@gmail.com>:
>>>> Can you invent an example, that can't be converted to polynomials?
>>>> Perhaps (a1+a2+a3+sqrt(5)*a4+sqrt(3)*a5)^25?
>>>
>>> Still doable. You need to involve log, exp, cos or similar
>>> transcendental functions.
>>
>> Can you show me how to do that? I tried:
>>
>> sage: K.<sqrt3> = QuadraticField(3)
>> sage: K.<sqrt5> = QuadraticField(5)
>> sage: R.<a1,a2,a3,a4,a5> = K[]
>> sage: time f = (a1+a2+a3+sqrt5*a4+sqrt3*a5)^25
>>
>> But I got:
>>
>> TypeError: unsupported operand parent(s) for '*': 'Number Field in
>> sqrt3 with defining polynomial x^2 - 3' and 'Multivariate Polynomial
>> Ring in a1, a2
>> , a3, a4, a5 over Number Field in sqrt5 with defining polynomial x^2 - 5'
>>
>> Full stacktrace here:
>>
>> https://gist.github.com/certik/a7f2434820f8dbf890b9
>
>
> I think I figured it out:
>
> sage: K.<sqrt3> = QuadraticField(3)
> sage: L.<sqrt5> = K.extension(x^2-5)
> sage: R.<a1,a2,a3,a4,a5> = L[]
> sage: time f = (a1+a2+a3+sqrt5*a4+sqrt3*a5)^18
> CPU times: user 2.43 s, sys: 3.94 ms, total: 2.44 s
> Wall time: 2.44 s
>
> (I did smaller exponent so that it finishes.)
>
> 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.
>

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