SageMath has built-in functions to compute the regulator and the fundamental unit of a quadratic field. The regulator of a quadratic field is the log of the absolute value of the fundamental unit. So, the following code should print out the same number on each line. But, as you can check, it does so only some of the time. Try checkRegulator(30) for example. I am using version 8.7. I also wrote other code (not included here) based on the Dedekind zeta function to compute the regulator. It agrees with SageMath's "regulator" function rather than with log of the fundamental unit.
def checkRegulator(N): for d in range(3,N): if not is_squarefree(d): continue K.<a> = QuadraticField(d) G = K.unit_group() u = G.gen(1).value(); Rdirect = abs(n(log(u))) RSage = K.regulator() print(d,RSage,Rdirect) -- 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/e0dfaf5a-d0d8-4ab1-acb8-595946c5f743%40googlegroups.com.