Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Characteristic polynomial of symbolic matrix of size 7

There is a problem when computing the characteristic polynomial of a matrix of size greater than 7 containing a large number of symbolic variables.

a = SR.var('a', 100)
M = identity_matrix(SR, 7)
for i in range(7):
  for j in range(7):
    M[i,j] = a[i*7+j]
print(M.charpoly().degree()) # prints 5

The value it should print is 7. Over $\mathbb{Z}[a_0,a_1,\dots]$, the result is correct.

Characteristic polynomial of symbolic matrix of size 7

There is a problem when computing the characteristic polynomial of a matrix of size greater than 7 containing a large number of symbolic variables.

a = SR.var('a', 100)
M = identity_matrix(SR, 7)
for i in range(7):
  for j in range(7):
    M[i,j] = a[i*7+j]
print(M.charpoly().degree()) # prints 5

The value it should print is 7. Over $\mathbb{Z}[a_0,a_1,\dots]$, the result is correct.

I use Sage 8.3 (Release Date: 2018-08-03), installed from the official repository of Archlinux. The bug is present both in command line and with sage file.sage (if I copy and paste the code above).

Characteristic polynomial of symbolic matrix of size 7

There is a problem when computing the characteristic polynomial of a matrix of size greater than 7 containing a large number of symbolic variables.

a = SR.var('a', 100)
M = identity_matrix(SR, 7)
for i in range(7):
  for j in range(7):
    M[i,j] = a[i*7+j]
print(M.charpoly().degree()) # prints 5

The value it should print is 7. Over $\mathbb{Z}[a_0,a_1,\dots]$, the result is correct.

I use Sage 8.3 (Release Date: 2018-08-03), installed from the official repository of Archlinux. The bug is present both in command line and with sage file.sage (if I copy and paste the code above).