# Revision history [back]

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     a^2 + a     a^3
a^3     a^3 + a^2   a^3
a^3     a^3 + a + 1     a^3
a^3     a^2 + 1     division by zero in finite field.
a^3     a^3 + a     a^3
a^3     a^2 + a + 1     a^3 + a^2 + a
a^3     a^3 + a^2 + a   a^3
a^3     a^3 + a^2 + a + 1   a^3
a^3     a^3 + a^2 + 1   division by zero in finite field.
a^3     a^3 + 1     a^3 + a + 1
a^3     1   a^3
a + 1   0   0
a + 1   a   a + 1
a + 1   a^2     a^3 + a^2
a + 1   a^3     a^2 + a
a + 1   a + 1   a + 1
a + 1   a^2 + a     a + 1
a + 1   a^3 + a^2   a + 1
a + 1   a^3 + a + 1     a + 1
a + 1   a^2 + 1     a + 1
a + 1   a^3 + a     division by zero in finite field.
a + 1   a^2 + a + 1     a + 1
a + 1   a^3 + a^2 + a   a^3 + a^2 + a + 1
a + 1   a^3 + a^2 + a + 1   a + 1
a + 1   a^3 + a^2 + 1   a + 1
a + 1   a^3 + 1     division by zero in finite field.
a + 1   1   a^2 + 1
a^2 + a     0   0
a^2 + a     a   a^3 + a
a^2 + a     a^2     a^2 + a
a^2 + a     a^3     a^3 + a + 1
a^2 + a     a + 1   a^3 + a^2
a^2 + a     a^2 + a     a^2 + a
a^2 + a     a^3 + a^2   a^2 + a
a^2 + a     a^3 + a + 1     a^2 + a
a^2 + a     a^2 + 1     a^2 + a
a^2 + a     a^3 + a     a^2 + a
a^2 + a     a^2 + a + 1     division by zero in finite field.
a^2 + a     a^3 + a^2 + a   a^2 + a
a^2 + a     a^3 + a^2 + a + 1   a^3 + a^2 + 1
a^2 + a     a^3 + a^2 + 1   a^2 + a
a^2 + a     a^3 + 1     a^2 + a
a^2 + a     1   division by zero in finite field.
a^3 + a^2   0   0
a^3 + a^2   a   division by zero in finite field.
a^3 + a^2   a^2     a^2 + a + 1
a^3 + a^2   a^3     a^3 + a^2
a^3 + a^2   a + 1   a^2 + 1
a^3 + a^2   a^2 + a     a^3 + a + 1
a^3 + a^2   a^3 + a^2   a^3 + a^2
a^3 + a^2   a^3 + a + 1     a^3 + a^2
a^3 + a^2   a^2 + 1     a^3 + a^2
a^3 + a^2   a^3 + a     a^3 + a^2
a^3 + a^2   a^2 + a + 1     a^3 + a^2
a^3 + a^2   a^3 + a^2 + a   division by zero in finite field.
a^3 + a^2   a^3 + a^2 + a + 1   a^3 + a^2
a^3 + a^2   a^3 + a^2 + 1   a^3 + 1
a^3 + a^2   a^3 + 1     a^3 + a^2
a^3 + a^2   1   a^3 + a^2
a^3 + a + 1     0   0
a^3 + a + 1     a   a^3 + a + 1
a^3 + a + 1     a^2     division by zero in finite field.
a^3 + a + 1     a^3     a^3 + a^2 + a
a^3 + a + 1     a + 1   a^3 + a + 1
a^3 + a + 1     a^2 + a     a^3 + a
a^3 + a + 1     a^3 + a^2   a^2 + 1
a^3 + a + 1     a^3 + a + 1     a^3 + a + 1
a^3 + a + 1     a^2 + 1     a^3 + a + 1
a^3 + a + 1     a^3 + a     a^3 + a + 1
a^3 + a + 1     a^2 + a + 1     a^3 + a + 1
a^3 + a + 1     a^3 + a^2 + a   a^3 + a + 1
a^3 + a + 1     a^3 + a^2 + a + 1   division by zero in finite field.
a^3 + a + 1     a^3 + a^2 + 1   a^3 + a + 1
a^3 + a + 1     a^3 + 1     1
a^3 + a + 1     1   a^3 + a + 1
a^2 + 1     0   0
a^2 + 1     a   a^2 + 1
a^2 + 1     a^2     a^2 + 1
a^2 + 1     a^3     division by zero in finite field.
a^2 + 1     a + 1   a^3 + a^2 + a + 1
a^2 + 1     a^2 + a     a^2 + 1
a^2 + 1     a^3 + a^2   a^2 + a + 1
a^2 + 1     a^3 + a + 1     a^3 + a
a^2 + 1     a^2 + 1     a^2 + 1
a^2 + 1     a^3 + a     a^2 + 1
a^2 + 1     a^2 + a + 1     a^2 + 1
a^2 + 1     a^3 + a^2 + a   a^2 + 1
a^2 + 1     a^3 + a^2 + a + 1   a^2 + 1
a^2 + 1     a^3 + a^2 + 1   division by zero in finite field.
a^2 + 1     a^3 + 1     a^2 + 1
a^2 + 1     1   a
a^3 + a     0   0
a^3 + a     a   a^2
a^3 + a     a^2     a^3 + a
a^3 + a     a^3     a^3 + a
a^3 + a     a + 1   division by zero in finite field.
a^3 + a     a^2 + a     a^3 + a^2 + 1
a^3 + a     a^3 + a^2   a^3 + a
a^3 + a     a^3 + a + 1     a^3 + a^2 + a
a^3 + a     a^2 + 1     a^2 + a + 1
a^3 + a     a^3 + a     a^3 + a
a^3 + a     a^2 + a + 1     a^3 + a
a^3 + a     a^3 + a^2 + a   a^3 + a
a^3 + a     a^3 + a^2 + a + 1   a^3 + a
a^3 + a     a^3 + a^2 + 1   a^3 + a
a^3 + a     a^3 + 1     division by zero in finite field.
a^3 + a     1   a^3 + a
a^2 + a + 1     0   0
a^2 + a + 1     a   a^2 + a + 1
a^2 + a + 1     a^2     a^3
a^2 + a + 1     a^3     a^2 + a + 1
a^2 + a + 1     a + 1   a^2 + a + 1
a^2 + a + 1     a^2 + a     division by zero in finite field.
a^2 + a + 1     a^3 + a^2   a^3 + 1
a^2 + a + 1     a^3 + a + 1     a^2 + a + 1
a^2 + a + 1     a^2 + 1     a^3 + a^2 + a + 1
a^2 + a + 1     a^3 + a     a^3 + a^2 + a
a^2 + a + 1     a^2 + a + 1     a^2 + a + 1
a^2 + a + 1     a^3 + a^2 + a   a^2 + a + 1
a^2 + a + 1     a^3 + a^2 + a + 1   a^2 + a + 1
a^2 + a + 1     a^3 + a^2 + 1   a^2 + a + 1
a^2 + a + 1     a^3 + 1     a^2 + a + 1
a^2 + a + 1     1   division by zero in finite field.
a^3 + a^2 + a   0   0
a^3 + a^2 + a   a   division by zero in finite field.
a^3 + a^2 + a   a^2     a^3 + a^2 + a
a^3 + a^2 + a   a^3     a + 1
a^3 + a^2 + a   a + 1   a^3 + a^2 + a
a^3 + a^2 + a   a^2 + a     a^3 + a^2 + a
a^3 + a^2 + a   a^3 + a^2   division by zero in finite field.
a^3 + a^2 + a   a^3 + a + 1     1
a^3 + a^2 + a   a^2 + 1     a^3 + a^2 + a
a^3 + a^2 + a   a^3 + a     a^3 + a^2 + 1
a^3 + a^2 + a   a^2 + a + 1     a^3 + a^2 + a + 1
a^3 + a^2 + a   a^3 + a^2 + a   a^3 + a^2 + a
a^3 + a^2 + a   a^3 + a^2 + a + 1   a^3 + a^2 + a
a^3 + a^2 + a   a^3 + a^2 + 1   a^3 + a^2 + a
a^3 + a^2 + a   a^3 + 1     a^3 + a^2 + a
a^3 + a^2 + a   1   a^3 + a^2 + a
a^3 + a^2 + a + 1   0   0
a^3 + a^2 + a + 1   a   a^3 + a^2 + a + 1
a^3 + a^2 + a + 1   a^2     division by zero in finite field.
a^3 + a^2 + a + 1   a^3     a^3 + a^2 + a + 1
a^3 + a^2 + a + 1   a + 1   a^2 + a
a^3 + a^2 + a + 1   a^2 + a     a^3 + a^2 + a + 1
a^3 + a^2 + a + 1   a^3 + a^2   a^3 + a^2 + a + 1
a^3 + a^2 + a + 1   a^3 + a + 1     division by zero in finite field.
a^3 + a^2 + a + 1   a^2 + 1     a
a^3 + a^2 + a + 1   a^3 + a     a^3 + a^2 + a + 1
a^3 + a^2 + a + 1   a^2 + a + 1     a^3 + 1
a^3 + a^2 + a + 1   a^3 + a^2 + a   a^3 + a^2 + 1
a^3 + a^2 + a + 1   a^3 + a^2 + a + 1   a^3 + a^2 + a + 1
a^3 + a^2 + a + 1   a^3 + a^2 + 1   a^3 + a^2 + a + 1
a^3 + a^2 + a + 1   a^3 + 1     a^3 + a^2 + a + 1
a^3 + a^2 + a + 1   1   a^3 + a^2 + a + 1
a^3 + a^2 + 1   0   0
a^3 + a^2 + 1   a   a^3 + a^2 + 1
a^3 + a^2 + 1   a^2     a^3 + a^2 + 1
a^3 + a^2 + 1   a^3     division by zero in finite field.
a^3 + a^2 + 1   a + 1   a^3 + a^2 + 1
a^3 + a^2 + 1   a^2 + a     a^3 + a^2
a^3 + a^2 + 1   a^3 + a^2   a^3 + a^2 + 1
a^3 + a^2 + 1   a^3 + a + 1     a^3 + a^2 + 1
a^3 + a^2 + 1   a^2 + 1     division by zero in finite field.
a^3 + a^2 + 1   a^3 + a     a^2
a^3 + a^2 + 1   a^2 + a + 1     a^3 + a^2 + 1
a^3 + a^2 + 1   a^3 + a^2 + a   1
a^3 + a^2 + 1   a^3 + a^2 + a + 1   a^3 + 1
a^3 + a^2 + 1   a^3 + a^2 + 1   a^3 + a^2 + 1
a^3 + a^2 + 1   a^3 + 1     a^3 + a^2 + 1
a^3 + a^2 + 1   1   a^3 + a^2 + 1
a^3 + 1     0   0
a^3 + 1     a   a^3 + 1
a^3 + 1     a^2     a^3 + 1
a^3 + 1     a^3     a^3 + 1
a^3 + 1     a + 1   division by zero in finite field.
a^3 + 1     a^2 + a     a^3 + 1
a^3 + 1     a^3 + a^2   a^3 + a + 1
a^3 + 1     a^3 + a + 1     a^3 + 1
a^3 + 1     a^2 + 1     a^3 + 1
a^3 + 1     a^3 + a     division by zero in finite field.
a^3 + 1     a^2 + a + 1     a^3
a^3 + 1     a^3 + a^2 + a   a^3 + 1
a^3 + 1     a^3 + a^2 + a + 1   a
a^3 + 1     a^3 + a^2 + 1   1
a^3 + 1     a^3 + 1     a^3 + 1
a^3 + 1     1   a^3 + 1
1   0   0
1   a   1
1   a^2     1
1   a^3     1
1   a + 1   1
1   a^2 + a     division by zero in finite field.
1   a^3 + a^2   1
1   a^3 + a + 1     a^2 + 1
1   a^2 + 1     1
1   a^3 + a     1
1   a^2 + a + 1     division by zero in finite field.
1   a^3 + a^2 + a   a + 1
1   a^3 + a^2 + a + 1   1
1   a^3 + a^2 + 1   a^2
1   a^3 + 1     a
1   1   1