Bug in quadratic_defect
This is not a question but a bug report, but since https://trac.sagemath.org/ is down, I don't know where to report bugs. Thus, I report it here. I hope it is the correct place,
There is a bug in the implementation of quadratic_defect function. It persists over a number of versions of Sage. I have Sage 9.5 and 10.3 beta 4 installed and the bug is in both versions. Here is a minimal example:
Qx.<x> = QQ[]
K.<t> = NumberField(x^10 - x^8 - 2*x^7 - x^6 + 2*x^5 + 2*x^4 - x^2 + 1)
p = K.prime_factors(2)[0]
pi = K.uniformizer(p)
a = 1 + pi^3
K.quadratic_defect(a,p)
This will throw an exception TypeError: Cannot convert non-integral float to integer
The problem is with the following line in the main loop of this routine:
s = self(q((a - 1) / pi**w)**(1/2))
To make the code work it should be replaced with something like this:
s = self( F.lift((q((a - 1) / pi**w)).sqrt()) )
Best regards, P.K.
P.S. Besides, if someone decides to correct this function as explained above, Iw ould also suggest to replace the code
# compute uniformizer pi
for g in p.gens():
if g.valuation(p) == 1:
pi = g
break
with just
# compute uniformizer pi
pi = K.uniformizer(p)
The issue was just reported at https://github.com/sagemath/sage/issu...