# 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 7157 ●16 ●78 ●156 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 4383 ●3 ●37 ●93

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 4383 ●3 ●37 ●93

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 25538 ●29 ●183 ●476 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 4383 ●3 ●37 ●93

x = 2 + sqrt(5)