Ask Your Question
1

Possible bug with product of matrices over GF with modulus

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

Johannes gravatar image

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

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 flag offensive close merge delete

Comments

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 +0100 )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 +0100 )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 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
1

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

rburing gravatar image

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

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

Comments

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 +0100 )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

Stats

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

Seen: 224 times

Last updated: Feb 23