Ask Your Question

Revision history [back]

Possible bug with product of matrices over GF with modulus

Below is a minimal example, where the product of two matrices over a finite field (with a pre-described modulus) is not computed correctly. I am looking forward to explanations about this unexpected behavior:

# adjoing a 16th root of unity to GF(3) gives a field extension of degree 4, explicitly:
F.<xi> = GF(3^4,modulus=x^4-x^2-1)
# now xi is a primitive 16th root of unity
print(xi^8==1,xi^16==1)
# matrix multiplication over F doesn't seem to work with Sage Kernel 10.0
a1=2*xi^2+2
a2=xi^2
A1=matrix(F,[a1])
A2=matrix(F,[a2])
# Sage does not compute the product of the two 1x1-matrices correctly:
print(A1*A2)
# this does not agree with the product of the underlying elements
print(a1*a2)

The output produced by Sage (Kernel 10.0) is:

False True
[2*xi^3 + 2*xi^2 + 2]
xi^2 + 2

Possible bug with product of matrices over GF with modulus

Below is a minimal example, where the product of two matrices over a finite field (with a pre-described modulus) is not computed correctly. I am looking forward to explanations about this unexpected behavior:

# adjoing a 16th root of unity to GF(3) gives a field extension of degree 4, explicitly:
F.<xi> = GF(3^4,modulus=x^4-x^2-1)
# now xi is a primitive 16th root of unity
print(xi^8==1,xi^16==1)
# matrix multiplication over F doesn't seem to work with Sage Kernel 10.0
a1=2*xi^2+2
a2=xi^2
A1=matrix(F,[a1])
A2=matrix(F,[a2])
# Sage does not compute the product of the two 1x1-matrices correctly:
print(A1*A2)
# this does not agree with the product of the underlying elements
print(a1*a2)

The output produced by Sage (Kernel 10.0) is:

False True
[2*xi^3 + 2*xi^2 + 2]
xi^2 + 2

Update: The problem persists even after updating to SageMath 10.2 on my desktop computer. The error is also reproducible on CoCalc.