Complex embedding with quotient()

34 views
Skip to first unread message

François Colas

unread,
May 7, 2014, 12:58:48 PM5/7/14
to sage-s...@googlegroups.com
Hello group,

I am playing with rings which look like K = Q[X]/<Phi_m(X)> with any large value m. Unfortunately I cannot use NumberField() because it's too long. I get around this by using quotient which is a little bit faster:

m = 3*5*7*11
Q.<x> = QQ['x']
Phi_m = cyclotomic_polynomial(m)
K.<k> = Q.quotient(Phi_m)

What I want to do is a way to evaluate polynomials of K in a power of a primitive square root of unity: 

omega = CC(e^(2*I*pi/m))
F = Hom(K, CC)
f = F([omega])
TypeError: images do not define a valid homomorphism

Does anyone see another way to do this?

Thanks,

François

Nils Bruin

unread,
May 7, 2014, 7:43:03 PM5/7/14
to sage-s...@googlegroups.com
On Wednesday, May 7, 2014 9:58:48 AM UTC-7, François Colas wrote:
What I want to do is a way to evaluate polynomials of K in a power of a primitive square root of unity: 

omega = CC(e^(2*I*pi/m))
F = Hom(K, CC)
f = F([omega])
TypeError: images do not define a valid homomorphism

Does anyone see another way to do this?
 
Have you tried using CyclotomicField(m) ? I think that uses specialized code, which should handle high degrees much better than generic number field code:

sage: K=CyclotomicField(3*5*7*11)
sage: K.coerce_embedding()
Generic morphism:
  From: Cyclotomic Field of order 1155 and degree 480
  To:   Complex Lazy Field
  Defn: zeta1155 -> 0.9999852033056930? + 0.00543996044764063?*I

Alternatively, if you really want to use an explicit quotient ring construction:

f = F([omega],check=False)

The error you run into otherwise is:

sage: sage.rings.morphism.RingHomomorphism_im_gens(H,[omega])
ValueError: relations do not all (canonically) map to 0 under map determined by images of generators.

i.e., the cyclotomic polynomial evaluated at omega doesn't return an exact zero, because CC uses float arithmetic.

Martin Albrecht

unread,
May 8, 2014, 2:16:41 AM5/8/14
to sage-s...@googlegroups.com
Hi Nils,

On Wednesday 07 May 2014 16:43:03 Nils Bruin wrote:
> On Wednesday, May 7, 2014 9:58:48 AM UTC-7, François Colas wrote:
> > What I want to do is a way to evaluate polynomials of K in a power of a
> > primitive square root of unity:
> >
> > omega = CC(e^(2*I*pi/m))
> > F = Hom(K, CC)
> > f = F([omega])
> > TypeError: images do not define a valid homomorphism
> >
> > Does anyone see another way to do this?
>
> Have you tried using CyclotomicField(m) ? I think that uses specialized
> code, which should handle high degrees much better than generic number
> field code:

unfortunately that's not the case for the OP, see:

https://groups.google.com/forum/#!searchin/sage-devel/QuotientRing|
sort:date/sage-devel/qxGMiYDF4eQ/zDcTmXWJH9UJ

> sage: K=CyclotomicField(3*5*7*11)
> sage: K.coerce_embedding()
> Generic morphism:
> From: Cyclotomic Field of order 1155 and degree 480
> To: Complex Lazy Field
> Defn: zeta1155 -> 0.9999852033056930? + 0.00543996044764063?*I
>
> Alternatively, if you really want to use an explicit quotient ring
> construction:
>
> f = F([omega],check=False)
>
> The error you run into otherwise is:
>
> sage: sage.rings.morphism.RingHomomorphism_im_gens(H,[omega])
> ValueError: relations do not all (canonically) map to 0 under map
> determined by images of generators.
>
> i.e., the cyclotomic polynomial evaluated at omega doesn't return an exact
> zero, because CC uses float arithmetic.

Cheers,
Martin
signature.asc

François Colas

unread,
May 9, 2014, 7:35:30 AM5/9/14
to sage-s...@googlegroups.com, martinr...@googlemail.com
That's exactly what I wanted to do

f = F([omega],check=False)

Thank you :)
Reply all
Reply to author
Forward
0 new messages