Ask Your Question
1

How to do arithmetic operation of elements in finite field?

asked 2021-01-25 13:35:17 +0100

anonymous user

Anonymous

updated 2021-01-25 13:46:40 +0100

Let us consider an example:

Var('x')
F.<x> = GF(13^2)

We consider two elements 2*x + 11, 3*x + 2 corresponding to the integers 37 and 41 respectively. Now we can operate them as

a=F.fetch_int(37)+F.fetch_int(41)
m=F.fetch_int(37)*F.fetch_int(41)

We have a=4*x + 10 , m= 4*x + 10

In reverse way we can get the corresponding integers as :

ai=a.integer_representation()
mi=m.integer_representation()

That is, ai=65, mi=62

How can I do the same for the field GF(251) using the same function?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-01-25 17:48:43 +0100

tmonteil gravatar image

updated 2021-01-25 17:55:46 +0100

Because 251 is prime, Sage choose a different implementation for GF(13^2) and GF(251), see:

sage: 251 in Primes()
True

sage: type(GF(13^2))
<class 'sage.rings.finite_rings.finite_field_givaro.FiniteField_givaro_with_category'>

sage: type(GF(251))
<class 'sage.rings.finite_rings.finite_field_prime_modn.FiniteField_prime_modn_with_category'>

As you can see, the field GF(13^2) is handled by givaro. If you look to the documentation of the GF constructor:

sage: GF?

you can see that you can chose the implementation yourself instead of relying to Sage best guess. Hence you can construct the field GF(251) using the givaro backend, which provides the fetch_int method:

sage: F.<x> = GF(251^2, impl='givaro') 
sage: a=F.fetch_int(37)+F.fetch_int(41)
sage: m=F.fetch_int(37)*F.fetch_int(41)
sage: ai=a.integer_representation()
sage: mi=m.integer_representation()
sage: ai,mi
(78, 11)

By the way, Var('x') is if no use here, since F.<x> = defines both F and x (and the var function name is lowercase).

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: 2021-01-25 13:35:17 +0100

Seen: 723 times

Last updated: Jan 25 '21