On Jan 27, 2009, at 4:02 PM, William Stein wrote:

> On Tue, Jan 27, 2009 at 1:51 PM, Robert Bradshaw
> <rober...@math.washington.edu> wrote:
>>
>>
>> On Jan 27, 2009, at 12:54 AM, William Stein wrote:
>>
>>>
>>> On Tue, Jan 27, 2009 at 12:45 AM, alia hamieh
>>> <aliasham...@gmail.com> wrote:
>>>> I'm trying to deal with following problem:
>>>>
>>>> G=DirichletGroup(75)
>>>> chi = list(G)[8]
>>>> I need to compute with expressions such as: chi(2)*sqrt(11)
>>>> the problem is that we cannot do this multiplication because we  
>>>> have
>>>> "incompatible" operands, the first belongs to the cyclotomic field
>>>> of order
>>>> 20 and the other one belongs to a symbolic ring.
>>>> Is there a way to fix this problem?
>>>>
>>>> alia
>>>
>>> You can do the following.  It's awkward but it works:
>>>
>>> sage: G = DirichletGroup(75)
>>> sage: chi = list(G)[8]
>>> sage: K = G.base_ring()
>>> sage: R.<x> = PolynomialRing(K)
>>> sage: L.<alpha> = K.extension(x^2 - 11)
>>> sage: chi(2) * alpha
>>> zeta20^4*alpha
>>>
>>> Here alpha = sqrt(11).
>>>
>>> Someday Robert Bradshaw is likely to make your original
>>> chi(2)*sqrt(11) work.  We'll see.
>>
>> This would require sqrt(11) to be a number field element rather than
>> a symbolic expression. For many things I think that would be a good
>> idea, but it has some drawbacks, like when trying to compute sum(sqrt
>> (p) for p in primes(1000))
>
> But couldn't doing chi(2) * sqrt(11) coerce chi(2) to the symbolic  
> ring and give
> the answer there?  I think that should make sense, because cyclotomic
> fields are
> now equipped with a fixed embedding into C.

Hmm... actually this does happen now:

sage: K.<a> = CyclotomicField(35)
sage: a + sqrt(11)
e^(2*I*pi/35) + sqrt(11)

And

sage: G = DirichletGroup(75)
sage: chi = list(G)[8]
sage: chi(2) * sqrt(11)
sqrt(11)*e^(2*I*pi/5)

This was part of the better symbolic minpoly work (which facilitated  
coercion in the other direction to, I forgot it finally got in) and  
now that we have embeddings too it's working. Of all people I should  
have remembered this--I guess my mind is elsewhere :)

So the answer is to upgrade Sage.

- 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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to