Skip to content

going from a complex field to a real field, and vice-versa #2096

@laurentbartholdi

Description

@laurentbartholdi

I'm trying to get hold of the real field associated with a complex field:

julia> ℂ = AcbField()
Complex Field with 256 bits of precision and error bounds

julia> real_field(ℂ)
ERROR: UndefVarError: `real_number_field` not defined in `Hecke`
Suggestion: check for spelling errors or missing imports.
Stacktrace:
 [1] real_field(args::AcbField; kwargs::@Kwargs{})
   @ Hecke ./deprecated.jl:116
 [2] real_field(args::AcbField)
   @ Hecke ./deprecated.jl:113
 [3] top-level scope
   @ REPL[120]:1

julia> ℝ = parent(real(one(ℂ)))
Real Field with 256 bits of precision and error bounds

There must be a simpler solution...

EDITOR'S NOTE: the following is copied from #2097

Given an ArbField, how do I construct the associated complex field?

julia> ℝ = ArbField(666)
Real Field with 666 bits of precision and error bounds

julia> ℂ = complex(ℝ) # BOOM
ERROR: MethodError: no method matching complex(::ArbField)
The function `complex` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  complex(::Type{Missing})
   @ Base missing.jl:111
  complex(::Missing)
   @ Base missing.jl:101
  complex(::Type{T}) where T<:Real
   @ Base complex.jl:195
  ...

Stacktrace:
 [1] top-level scope
   @ REPL[140]:1

julia> complex(Float64) # works
ComplexF64 (alias for Complex{Float64})

julia> ℂ = AcbField(precision(ℝ)) # ugly and non-generic
Complex Field with 666 bits of precision and error bounds

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions