field element
sagemath code to find out the element is finite field element.
add a comment
asked 2018-03-14 14:06:08 +0100
Anonymous
sagemath code to find out the element is finite field element.
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
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2018-03-14 14:06:08 +0100
Seen: 126 times
Last updated: Mar 14 '18