ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 12 Apr 2013 05:32:51 -0500Quadratic number fieldshttps://ask.sagemath.org/question/10015/quadratic-number-fields/Hello!
I try to implement an inclusion test, of which I thought it must be quite simple, but until now I cannot figure out how to do it properly.
Problem: Given any element x, test if x is included in some quadratic number field and return true/false.
I tried the following:
x = 2 + sqrt(5)
K = QuadraticField(5)
print(x in K)
Here, the answer is 'no' or 'false' which is obviously wrong, so I assume I'm doing something completely wrong. What do I have to change?pinwheelFri, 12 Apr 2013 05:32:51 -0500https://ask.sagemath.org/question/10015/