Ask Your Question
0

field element

asked 2018-03-14 14:06:08 +0100

anonymous user

Anonymous

sagemath code to find out the element is finite field element.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-03-14 18:58:36 +0100

dan_fulea gravatar image

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

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-03-14 14:06:08 +0100

Seen: 126 times

Last updated: Mar 14 '18