# 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.

edit retag close merge delete

For me, this is correcly done on Sagemath 10.3.beta8.

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

Can you reproduce it on Sagecell and post the (permanent) link ?

What happens when you try to reproduce @rburing's code in Cocalc ? In your Sage installation ?

( 2024-02-23 13:48:00 +0200 )edit

Strangely enough, @rburing's code runs correctly on SageMathCell, but neither on Cocalc nor on my Sage installation.

( 2024-02-23 13:54:01 +0200 )edit

I'm not sure if that's relevant, but CoCalc runs venv-python3.11.1/bin/sage, while SageCell runs venv-python3.10/bin/sage

( 2024-02-23 15:40:37 +0200 )edit

Sort by ยป oldest newest most voted

This is fixed in SageMath 10.2; run in SageMathCell.

It would be nice to find the corresponding issue and the pull request that fixed it, but I didn't find them in a cursory search.

more

Thank you for the quick reply, and for the link to SageMathCell. I have updated to SageMath 10.2, but the problem persists. I have also tried it on CoCalc (which runs with SageMath 10.2) and the same problem occurs.

( 2024-02-23 13:37:57 +0200 )edit