1 | initial version |
code to find if element in finite field
def is_element_in_finite_field( something ):
try:
parent = something.parent()
if parent.is_field() and parent.is_finite():
return True
return False
except Exception:
return False
test
sage: is_element_in_finite_field( 2018 )
False
sage: is_element_in_finite_field( GF(2017)(2018) )
True
sage: is_element_in_finite_field( QQ(2018) )
False
sage: is_element_in_finite_field( factorial(17) )
False
sage: F.<a> = GF(2048)
sage: is_element_in_finite_field( F.random_element() )
True
quapla