Grégory Vanuxem
unread,Apr 3, 2024, 7:12:12 AMApr 3Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Nemo-Devel
Hello,
I am writing an interface to the Julia Nemo package and am facing the
problem of generating the Julia 'im' constant in the number fields
mentioned in the object of this email. Is there a way to obtain it in
another way than with sqrt(-1)?
Here is a Julia session that shows that and other things that could
eventually be easily added to Nemo.
=====================================================
julia> C=AcbField()
Complex Field with 256 bits of precision and error bounds
julia> R=ArbField()
Real Field with 256 bits of precision and error bounds
julia> CC=ComplexField()
Complex field
julia> const_e(R)
[2.7182818284590452353602874713526624977572470936999595749669676277240766303535
+/- 5.46e-77]
julia> RR=RealField()
Real field
julia> const_e(RR)
[2.718281828459045235 +/- 4.29e-19]
julia> const_pi(C)
[3.1415926535897932384626433832795028841971693993751058209749445923078164062862
+/- 1.93e-77]
julia> const_pi(CC)
[3.141592653589793239 +/- 5.96e-19]
julia> const_e(CC)
ERROR: MethodError: no method matching const_e(::ComplexField)
The function `const_e` exists, but no method is defined for this
combination of argument types.
Closest candidates are:
const_e(::RealField, ::Int64)
@ Nemo ~/.julia/packages/Nemo/9d4V8/src/arb/Real.jl:998
const_e(::RealField)
@ Nemo ~/.julia/packages/Nemo/9d4V8/src/arb/Real.jl:998
const_e(::ArbField)
@ Nemo ~/.julia/packages/Nemo/9d4V8/src/arb/arb.jl:1039
Stacktrace:
[1] top-level scope
@ REPL[32]:1
julia> const_e(C)
ERROR: MethodError: no method matching const_e(::AcbField)
The function `const_e` exists, but no method is defined for this
combination of argument types.
Closest candidates are:
const_e(::RealField, ::Int64)
@ Nemo ~/.julia/packages/Nemo/9d4V8/src/arb/Real.jl:998
const_e(::RealField)
@ Nemo ~/.julia/packages/Nemo/9d4V8/src/arb/Real.jl:998
const_e(::ArbField)
@ Nemo ~/.julia/packages/Nemo/9d4V8/src/arb/arb.jl:1039
Stacktrace:
[1] top-level scope
@ REPL[33]:1
julia> sqrt(CC(-1))
1.0000000000000000000*im
julia> sqrt(C(-1))
1.00000000000000000000000000000000000000000000000000000000000000000000000000000*im
julia>
==================================================
As you can also see, const_e(CC) and const_e(C) are not implemented
for complex number fields whereas const_pi is. Maybe this constant can
also be added to complex number fields. As of now I have not begun to
use exact real/complex number fields using Calcium via Nemo so I do
not know for this, my main question is how to generate 'im' in those
fields without using 'sqrt'.
Kind regards,
- Greg