Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix quadratic_defect #37656

Open
2 tasks done
nbruin opened this issue Mar 23, 2024 · 0 comments
Open
2 tasks done

Fix quadratic_defect #37656

nbruin opened this issue Mar 23, 2024 · 0 comments
Labels

Comments

@nbruin
Copy link
Contributor

nbruin commented Mar 23, 2024

Steps To Reproduce

No response

Expected Behavior

From https://groups.google.com/g/sage-devel/c/KfvLDTqf4rk/m/_4SAoCDtAgAJ :

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)

should work

Actual Behavior

It actually produces a

TypeError: cannot convert non-integral float to integer

Additional Information

Reason is clear:
the line that produces the error is:

s = self(q((a - 1) / pi**w)**(1/2))

That code can never have worked properly, but in python 3, 1/2 will be a float and the finite field element constructed here cannot be raised to a float power. A line that could work is:

s = self(q((a - 1) / pi**w).sqrt())

although it would probably worth checking if there are no other bugs in the code. Doctests need to be improved for this code too, since this error must have been lurking since the implementation was merged.

The post has another suggestion to change the computation of a uniformizing element, presently:

# compute uniformizer pi
for g in p.gens():
if g.valuation(p) == 1:
pi = g
break

and use pi = K.uniformizer(p) instead. It looks like that is indeed a more robust way (and internally does actually much the same thing but with more knowledge of the internal representation)

Environment

- **Sage Version**: 10.3

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide
@nbruin nbruin added the t: bug label Mar 23, 2024
@nbruin nbruin mentioned this issue Mar 23, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant