Ask Your Question

# Revision history [back]

### Function in GF(16)

Hi,

I've one problem in the following task. My calculations:

I'm defining following function:

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


Next, I'm calculating all possible values in GF(16) for the function T:

F.<a>=GF(16)
for a,b in F^2:
print "x=",a,"y=",b, "T:",a*custom_divide((c+1)*((custom_divide(a,b))^3+1)+(c^3+c)*((custom_divide(a,b))^2+custom_divide(a,b)),(custom_divide(a,b))^4+(c+1)*(custom_divide(a,b))^2+1)+(a*b).nth_root(2)


I know that c is not defined in that code but I wrote it there because it helps me with describing my problem. c+1 and c^3+c are constants and I don't know how can I write them in my code. If I'll write:

F.<a>=GF(16)
for a,b in F^2:
print "x=",a,"y=",b, "T:",a*custom_divide((a+1)*((custom_divide(a,b))^3+1)+(a^3+a)*((custom_divide(a,b))^2+custom_divide(a,b)),(custom_divide(a,b))^4+(a+1)*(custom_divide(a,b))^2+1)+(a*b).nth_root(2)


then this constants will be equal to the variable a and will be change in every steps, but they should be the same in all cases.

How can I correct my code?

I'll be grateful for any help in this task.