[GAP Forum] Square root of cyclotomic real number

Samuel Lelièvre samuel.lelievre at gmail.com
Thu May 19 03:30:01 BST 2016


Dear forum,

To complement Dima's answer, if you are using Sage,
you should be aware that Sage provides two useful
exact fields:
- QQbar, the algebraic closure of QQ,
- AA, the "algebraic real field", which is the intersection
  of QQbar with the reals.

I would advise you to work in AA for your problem.

Defining, as Dima suggested,

    sage: a = libgap.eval('E(20)-E(20)^9').sage()

you get an element in a cyclotomic field:

    sage: a
    -zeta20^7 + zeta20^5 - zeta20^3 + 2*zeta20
    sage: a.parent()
    Cyclotomic Field of order 20 and degree 8

Now if you take its square root naively, you end up
in Sage's "Symbolic Ring" which is something to avoid
in general.

    sage: b = a.sqrt()
    sage: b
    sqrt(-(1/4*I*sqrt(5) + 1/4*sqrt(2*sqrt(5) + 10) - 1/4*I)^7
    + (1/4*I*sqrt(5) + 1/4*sqrt(2*sqrt(5) + 10) - 1/4*I)^5
    - (1/4*I*sqrt(5) + 1/4*sqrt(2*sqrt(5) + 10) - 1/4*I)^3
    + 1/2*I*sqrt(5) + 1/2*sqrt(2*sqrt(5) + 10) - 1/2*I)
    sage: b.parent()
    Symbolic Ring

The best is to work with AA

    sage: AA
    Algebraic Real Field

by moving there explicitly

    sage: aa = AA(a)
    sage: aa
    1.902113032590308?
    sage: aa.parent()
    Algebraic Real Field

Elements of AA are exact, and well-defined:

    sage: aa.minpoly()
    x^4 - 5*x^2 + 5

Taking square roots stays in AA

    sage: bb = aa.sqrt()
    sage: bb
    1.379171139703231?
    sage: bb.parent()
    Algebraic Real Field
    sage: bb.minpoly()
    x^8 - 5*x^4 + 5

I hope this helps.
Samuel



More information about the Forum mailing list