Ask Your Question

Possible bug with product of matrices over GF with modulus

asked 2024-02-22 17:58:22 +0200

Johannes gravatar image

updated 2024-02-23 13:41:21 +0200

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
# matrix multiplication over F doesn't seem to work with Sage Kernel 10.0
# Sage does not compute the product of the two 1x1-matrices correctly:
# this does not agree with the product of the underlying elements

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 flag offensive 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 ?

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 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.

Johannes gravatar imageJohannes ( 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

Max Alekseyev gravatar imageMax Alekseyev ( 2024-02-23 15:40:37 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2024-02-23 11:11:31 +0200

rburing gravatar image

updated 2024-02-23 11:12:01 +0200

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.

edit flag offensive delete link 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.

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2024-02-22 17:58:22 +0200

Seen: 162 times

Last updated: Feb 23