Ask Your Question
0

field element

asked 2018-03-14 08:06:08 -0600

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 12:58:36 -0600

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 08:06:08 -0600

Seen: 36 times

Last updated: Mar 14