Ask Your Question

Arczi84's profile - activity

2022-09-19 20:02:57 +0100 received badge  Notable Question (source)
2022-09-19 20:02:57 +0100 received badge  Popular Question (source)
2021-11-19 16:27:11 +0100 received badge  Notable Question (source)
2021-11-19 16:27:11 +0100 received badge  Popular Question (source)
2020-01-18 15:24:20 +0100 received badge  Famous Question (source)
2017-03-12 17:07:47 +0100 received badge  Notable Question (source)
2017-02-27 20:33:36 +0100 received badge  Popular Question (source)
2012-05-08 17:29:13 +0100 marked best answer Function in GF(16)

I have no idea of what you are asking or what you are trying to compute. But if you define a to be the generator of your field then it is very confusing to use a as the loop variable. For example:

sage: F.<a>=GF(16)
sage: 1+3*a
a + 1
sage: 16*a
0

Using a as a loop variable overwrites it:

sage: for a in range(3): print a
0
1
2
sage: a
2
2012-05-08 17:29:04 +0100 received badge  Scholar (source)
2012-05-08 17:29:04 +0100 marked best answer Function in GF(16)

How about this. I'll leave it as an exercise to handle the divide by zero:

sage: F.<a>=GF(16)
sage: def T(x,y,c):
...      return ((y/x + y^3/x^3)*(c^2 + c + 1)*c^2 + (y/x + y^4/x^4)*c^2)*x/(c*y^2/x^2 + y^4/x^4 + 1) + sqrt(x*y)
sage: for x,y in CartesianProduct(list(F),list(F)):
...   try:
...       print x, '\t', y, '\t', T(x, y, c=1)
...   except Exception, e:
...       print e
0   0   division by zero in finite field.
0   a   division by zero in finite field.
0   a^2     division by zero in finite field.
0   a^3     division by zero in finite field.
0   a + 1   division by zero in finite field.
0   a^2 + a     division by zero in finite field.
0   a^3 + a^2   division by zero in finite field.
0   a^3 + a + 1     division by zero in finite field.
0   a^2 + 1     division by zero in finite field.
0   a^3 + a     division by zero in finite field.
0   a^2 + a + 1     division by zero in finite field.
0   a^3 + a^2 + a   division by zero in finite field.
0   a^3 + a^2 + a + 1   division by zero in finite field.
0   a^3 + a^2 + 1   division by zero in finite field.
0   a^3 + 1     division by zero in finite field.
0   1   division by zero in finite field.
a   0   0
a   a   a
a   a^2     a
a   a^3     a
a   a + 1   a
a   a^2 + a     a
a   a^3 + a^2   division by zero in finite field.
a   a^3 + a + 1     a
a   a^2 + 1     a^3 + a
a   a^3 + a     a
a   a^2 + a + 1     a
a   a^3 + a^2 + a   division by zero in finite field.
a   a^3 + a^2 + a + 1   a^2 + a
a   a^3 + a^2 + 1   a
a   a^3 + 1     a^3
a   1   a^2
a^2     0   0
a^2     a   a^3
a^2     a^2     a^2
a^2     a^3     a^2
a^2     a + 1   a^2
a^2     a^2 + a     a^2
a^2     a^3 + a^2   a^2
a^2     a^3 + a + 1     division by zero in finite field.
a^2     a^2 + 1     a^2
a^2     a^3 + a     a^2 + a + 1
a^2     a^2 + a + 1     a^2
a^2     a^3 + a^2 + a   a^2
a^2     a^3 + a^2 + a + 1   division by zero in finite field.
a^2     a^3 + a^2 + 1   a^3 + a^2
a^2     a^3 + 1     a^2
a^2     1   a + 1
a^3     0   0
a^3     a   a^2 + a
a^3     a^2     a + 1
a^3     a^3     a^3
a^3     a + 1   a^3
a^3 ...
(more)
2012-05-08 17:28:49 +0100 answered a question Function in GF(16)

Thank You for help:) I'll do this exercise.

2012-05-08 16:55:48 +0100 answered a question Function in GF(16)

Maybe You are right, so I'll write it more clearly (I hope).

Let GF(2^4)={0, 1, a, a+1, a^2, a^2+1, a^2+a, a^2+a+1, a^3, a^3+1, a^3+a, a^3+a+1, a^3+a^2, a^3+a^2+1, a^3+a^2+a, a^3+a^2+a+1} and a^4+a+1=0.

Let T:= x*([c^2((y/x)^4+(y/x))+c^2(1+c+c^2)((y/x)^3+(y/x))]/[(y/x)^4+c(y/x)^2+1])+(xy)^(1/2),

where c is constant in GF(16) (for example c=a^2+a). Convention: if x=0 then y/x=0 (custom_divide).

Now I want to calculate all values of the function T:

x=0            y=0            T=...
x=0            y=1            T=...
x=0            y=a            T=...
...
x=a^3+a^2+a+1  y=a^3+a^2+1    T=...
x=a^3+a^2+a+1  y=a^3+a^2+a    T=...
x=a^3+a^2+a+1  y=a^3+a^2+a+1  T=...

I've to define this function T with this constant c.

2012-05-08 15:29:07 +0100 asked a question 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.

2012-04-15 17:11:14 +0100 asked a question Trace function over GF(q)

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

2012-04-09 17:13:25 +0100 received badge  Supporter (source)
2012-04-09 17:13:10 +0100 answered a question Define function in GF(q)

Hi,

Thanks for the answer. Yes, it helps:)

Regards

2012-04-06 11:08:12 +0100 asked a question Define function in GF(q)

Hi,

First of all I say that these are my first steps in SAGE. I want to define a function f(x,y), where x,y in GF(q), q=2^3 and next check all possible values of this function (for all x,y in GF(q)). If it will be necessary I'll write more details about function f.

Could you give me some advices how can I do it in SAGE? Any help will be highly appreciated.

I wish you a very happy Easter!

Best regards,

Artur