Skip to content

Commit

Permalink
Add docstrings for ZZ, QQ, QQBar, algebraic_closure (#1708)
Browse files Browse the repository at this point in the history
Co-authored-by: Lars Göttgens <[email protected]>
  • Loading branch information
fingolfin and lgoettgens authored Apr 26, 2024
1 parent 2d195bb commit e273779
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Nemo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,10 @@ const _ecm_nCs = Vector{Int}[_ecm_nC]
#
###############################################################################

@doc zz_ring_doc
const FlintZZ = ZZ

@doc qq_field_doc
const FlintQQ = QQ

###############################################################################
Expand All @@ -588,6 +591,7 @@ GaussianRationals() = FlintQQi
#
###############################################################################

@doc qqbar_field_doc
const QQBar = CalciumQQBar


Expand Down
25 changes: 25 additions & 0 deletions src/calcium/CalciumTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,36 @@ end
#
################################################################################

qqbar_field_doc = raw"""
QQBarField <: Field
QQBarFieldElem <: FieldElem
The algebraic closure $\overline{\mathbb Q}$ of the rationals $\mathbb Q$ and
its elements. This is a singleton type, meaning that there is a unique global
instance of this field, which can be obtained via `algebraic_closure(QQ)`.
```jldoctest
julia> K = algebraic_closure(QQ)
Field of algebraic numbers
julia> sqrt(K(2))
Root 1.41421 of x^2 - 2
julia> QQBar(2//3)
Root 0.666667 of 3x - 2
julia> sinpi(QQBar(2//3))
Root 0.866025 of 4x^2 - 3
```
"""

@doc qq_field_doc
struct QQBarField <: Field
end

const CalciumQQBar = QQBarField()

@doc qq_field_doc
mutable struct QQBarFieldElem <: FieldElem
coeffs::Ptr{Nothing}
alloc::Int
Expand Down
16 changes: 16 additions & 0 deletions src/calcium/qqbar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1538,4 +1538,20 @@ end
#
###############################################################################

"""
algebraic_closure(::QQField)
Return a field representing the algebraic closure of the field of
rational numbers.
# Examples
```jldoctest
julia> K = algebraic_closure(QQ)
Field of algebraic numbers
julia> sqrt(K(2))
Root 1.41421 of x^2 - 2
```
"""
algebraic_closure(::QQField) = QQBar

0 comments on commit e273779

Please sign in to comment.