Ask Your Question
0

Trace function over GF(q)

asked 2012-04-15 10:11:14 -0500

Arczi84 gravatar image

Hi,

I understand the idea of defining functions over GF(q) which You explained me very precisely. Now I have following problem:

I want to define the function:

f(x,y)=Tr(x*g(y/x)), where Tr(x)=x+x^2+x^4 (Tr:GF(8)-->GF(2)) and

x*g(y/x)=[(y*[d^2*[(y/x)^3+1]+d^2*(1+d+d^2)*[(y/x)^2+(y/x)]])/((y/x)^4+d^2*(y/x)^2+1)]+(y/x)^(1/2).

Let (for example) d=3.

With convention that 1/0=0 (y/0=0), I want to see what values this function f receives. How can I do this in SAGE?

What I did (with Yours help):

def custom_divide(x,y):
    if y==0:
        return 0
    return x/y

F.<a>=GF(8)
for a,b in F^2:
    print "x: ",a,"y: ",b,"x/y: ",custom_divide(a,b)

F.<a>=GF(8)
for a,b in F^2:
    print "x*y: ",a*b,"(x*y)^2: ",(a*b)^2,"(x*y)^(1/2): ",(a*b).nth_root(2)

I'm stopped here because I'm not sure how can I define such function f. Any help/advices will be highly appreciated.

I could write more details if something is not clear.

Best regards, Arczi

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-03-09 12:40:59 -0500

dan_fulea gravatar image

The following code is doing the job. (I hope the formula was retyped in an equivalent manner. For instance, (y/x)^(1/2) was replaced for our purposes by (y/x)^4 .)

F8 = GF(8)
F2 = GF(2)

def f( x, y, field=F8, d=3 ):

    if x == field(0):    y_by_x = field(0)
    else            :    y_by_x = y / x

    return d^2 * ( y * ( y_by_x^3 + 1 ) + ( 1 + d + d^2 ) * y_by_x * ( y_by_x + 1 ) ) \
        / \
        ( y_by_x^4 + d^2 * y_by_x^2 + 1 ) \
        + \
        y_by_x^4

print matrix( F2, 8, 8, [ [ f( x, y, F8, 3 ).trace() for y in F8 ] for x in F8 ] )

We get:

[0 0 0 1 0 1 1 1]
[0 1 1 1 0 0 1 0]
[0 0 1 0 1 1 1 0]
[0 0 1 1 0 0 1 1]
[0 1 0 1 1 1 0 0]
[0 1 0 1 0 1 0 1]
[0 0 0 0 1 1 1 1]
[0 1 1 0 1 0 0 1]

N.B. Which is the meaning of the above result?

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

Stats

Asked: 2012-04-15 10:11:14 -0500

Seen: 299 times

Last updated: Mar 09