44 views

Skip to first unread message

Dec 26, 2021, 3:21:18 PM12/26/21

to sage-support

I want to compute the regulator of a real quadratic field Q(sqrt d) to high precision,

accurately enough to compute the fundamental unit. The default

breaks at d = 331 where fundamental unit needs more than 53 bits (the precision of doubles). The documentation says that Pari computes to a higher precision than

SageMath. Also somewhere it says that if you get a good enough approximation to the regulator, it's trivial to refine it to high accuracy. It refers to "the tutorial" without a link; I read the Pari-GP tutorials on algebraic number theory without finding any explanation of that remark. So actually there are two questions here: point me to an explanation of refining the computation of the regulator, and secondly, fix the following code

so that it doesn't print "oops" when d = 331.

gp.set_real_precision(256) # doesn't seem to do anything

def check_unit(N):

for d in range(10,N):

if not is_squarefree(d):

continue

K.<a> = QuadraticField(d)

G = K.unit_group()

[x,y] = G.gen(1).value()

x = abs(x)

R = K.regulator(None)

twox = round(exp(R))

x2 = twox/2

y2 = round(twox/sqrt(d))/2

print(d,x,x2,y,y2,exp(R)/2)

if x != x2 or y != y2:

print("oops!")

return

if norm_is_negative(x,d):

print("norm is negative")

def check_unit(N):

for d in range(10,N):

if not is_squarefree(d):

continue

K.<a> = QuadraticField(d)

G = K.unit_group()

[x,y] = G.gen(1).value()

x = abs(x)

R = K.regulator(None)

twox = round(exp(R))

x2 = twox/2

y2 = round(twox/sqrt(d))/2

print(d,x,x2,y,y2,exp(R)/2)

if x != x2 or y != y2:

print("oops!")

return

if norm_is_negative(x,d):

print("norm is negative")

Dec 27, 2021, 12:52:18 PM12/27/21

to sage-support

The "regulator" access routine should indeed at least allow to produce the regulator with the precision that pari used.

If you look at the source of "regulator" you can see how to get the regulator to better precision. If K is your number field, then:

K.pari_bnf().bnf_get_reg().sage()

gets you the regulator straight from pari (pari should really be choosing an appropriate working precision here by itself).

I'm not so sure that computing the regulator this way is efficient for quadratic extensions: there are way better special algorithms for that (continued fractions do a lot of the work already, for instance). The general algorithm determines the regulator by determining the class group and unit group. So finding the fundamental unit through a regulator computation wouldn't really make much sense.

Dec 28, 2021, 1:13:36 AM12/28/21

to sage-support

See also

- Ask Sage question 60455: compute regulator with more precision

Jan 14, 2022, 11:35:00 AMJan 14

to sage-support

You could just do R = K.embeddings(RealField(1000))[0](K.units()[0]).log().abs(), for instance.

Reply all

Reply to author

Forward

0 new messages

Search

Clear search

Close search

Google apps

Main menu