# Abelian closure of the rationals

The abelian closure $\mathbf{Q}^\text{ab}$ is the maximal abelian extension of $\mathbf{Q}$ inside a fixed algebraic closure and can explicitly described as

$$$\mathbf{Q}^{\mathrm{ab}} = \mathbf{Q}(\zeta_n \mid n \in \mathbf{N}),$$$

the union of all cyclotomic extensions. Here for $n \in \mathbf{N}$ we denote by $\zeta_n$ a primitive $n$-th root of unity.

## Creation of the abelian closure and elements

abelian_closureMethod
abelian_closure(QQ::RationalField)

Return a pair (K, z) consisting of the abelian closure K of the rationals and a generator z that can be used to construct primitive roots of unity in K.

An optional keyword argument sparse can be set to true to switch to a sparse representation. Depending on the application this can be much faster or slower.

Examples

julia> K, z = abelian_closure(QQ);

julia> z(36)
ζ(36)

julia> K, z = abelian_closure(QQ, sparse = true);

julia> z(36)
-ζ(36, 9)*ζ(36, 4)^4 - ζ(36, 9)*ζ(36, 4)

source

Given the abelian closure, the generator can be recovered as follows:

genMethod
gen(M::SubQuo{T}, i::Int) where T

Return the ith generator of M.

source

## Printing

The n-th primitive root of the abelian closure of will by default be printed as z(n). The printing can be manipulated using the following functions:

genMethod
gen(K::QQAbField, s::String)

Return the generator of the abelian closure K that can be used to construct primitive roots of unity. The string s will be used during printing.

source
set_variable!Method
set_variable!(K::QQAbField, s::String)

Change the printing of the primitive n-th root of the abelian closure of the rationals to s(n), where s is the supplied string.

source
get_variableMethod
get_variable(K::QQAbField)

Return the string used to print the primitive n-th root of the abelian closure of the rationals.

source

### Examples

julia> K, z = abelian_closure(QQ);

julia> z(4)
z(4)

julia> ζ = gen(K, "ζ")
Generator of abelian closure of Q

julia> ζ(5) + ζ(3)
ζ(15)^5 + ζ(15)^3