# Revision history [back]

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?

 2 code indentation vdelecroix 6757 ●16 ●73 ●144 http://www.labri.fr/pe...

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)
print(x in K)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?

 3 retagged FrédéricC 2919 ●3 ●31 ●58

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

 4 retagged FrédéricC 2919 ●3 ●31 ●58

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

 5 retagged tmonteil 22218 ●25 ●158 ●409 http://wiki.sagemath.o...

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

 6 retagged FrédéricC 2919 ●3 ●31 ●58

x = 2 + sqrt(5)