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

On Sunday, December 26, 2021 at 9:21:18 PM UTC+1 Michael Beeson wrote:

> 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")
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/21f9a8e3-4eb9-4138-ae7a-d0ebec316576n%40googlegroups.com.

Reply via email to