# Determinant and missing denominator

There is a problem in the following computation, some denominators are missing. It is computing the determinant of a matrix whose entries have some 1/x_i everywhere, but SageMath 9.2 provides a polynomial result (i.e. without denominators).

sage: M1=identity_matrix(2)
sage: M2=matrix([[1,1],[1,1]])
sage: M3=matrix([[1,1],[1,1]])
sage: M4=matrix([[1,1],[1,1]])
sage: M5=matrix([[2,1],[1,2]])
sage: M6=matrix([[0,3],[3,1]])
sage: M7=matrix([[3,1],[1,2]])
sage: L=[M1,M2,M3,M4,M5,M6,M7]
sage: var('x2,x3,x4,x5,x6,x7')
sage: dim=[1,x2,x3,x4,x5,x6,x7]
sage: M=sum((L[i].tensor_product(L[i])).tensor_product(L[i])/(dim[i]) for i in range(7))
sage: M.determinant().denominator()
1
sage: (M.determinant()).factor()
(216*x2*x5^3 + 216*x3*x5^3 + 216*x4*x5^3 + 729*x5^4 - 2583*x2*x5^2*x6 - 2583*x3*x5^2*x6 - 2583*x4*x5^2*x6 - 7560*x5^3*x6 - 19872*x2*x5*x6^2 - 19872*x3*x5*x6^2 - 19872*x4*x5*x6^2 - 81270*x5^2*x6^2 + 91125*x2*x6^3 + 91125*x3*x6^3 + 91125*x4*x6^3 + 204120*x5*x6^3 + 531441*x6^4 + 1833*x2*x5^2*x7 + 1833*x3*x5^2*x7 + 1833*x4*x5^2*x7 + 7344*x5^3*x7 - 12438*x2*x5*x6*x7 - 12438*x3*x5*x6*x7 - 12438*x4*x5*x6*x7 - 45363*x5^2*x6*x7 - 36963*x2*x6^2*x7 - 36963*x3*x6^2*x7 - 36963*x4*x6^2*x7 - 305424*x5*x6^2*x7 + 216513*x6^3*x7 + 4600*x2*x5*x7^2 + 4600*x3*x5*x7^2 + 4600*x4*x5*x7^2 + 24990*x5^2*x7^2 - 12115*x2*x6*x7^2 - 12115*x3*x6*x7^2 - 12115*x4*x6*x7^2 - 75320*x5*x6*x7^2 - 240570*x6^2*x7^2 + 3375*x2*x7^3 + 3375*x3*x7^3 + 3375*x4*x7^3 + 34000*x5*x7^3 - 37125*x6*x7^3 + 15625*x7^4 + 312*x2*x5^2 + 312*x3*x5^2 + 312*x4*x5^2 + 1080*x5^3 - 774*x2*x5*x6 - 774*x3*x5*x6 - 774*x4*x5*x6 - 1263*x5^2*x6 - 4572*x2*x6^2 - 4572*x3*x6^2 - 4572*x4*x6^2 - 22536*x5*x6^2 - 13851*x6^3 + 1658*x2*x5*x7 + 1658*x3*x5*x7 + 1658*x4*x5*x7 + 7497*x5^2*x7 - 3050*x2*x6*x7 - 3050*x3*x6*x7 - 3050*x4*x6*x7 - 6256*x5*x6*x7 - 45711*x6^2*x7 + 1900*x2*x7^2 + 1900*x3*x7^2 + 1900*x4*x7^2 + 15400*x5*x7^2 - 5275*x6*x7^2 + 9375*x7^3 + 104*x2*x5 + 104*x3*x5 + 104*x4*x5 + 390*x5^2 - 191*x2*x6 - 191*x3*x6 - 191*x4*x6 - 184*x5*x6 - 1710*x6^2 + 257*x2*x7 + 257*x3*x7 + 257*x4*x7 + 1632*x5*x7 + 193*x6*x7 + 1500*x7^2 + 8*x2 + 8*x3 + 8*x4 + 40*x5 + 19*x6 + 75*x7 + 1)*(27*x5^2 + 108*x5*x6 - 729*x6^2 + 120*x5*x7 + 135*x6*x7 + 125*x7^2 + 12*x5 - 9*x6 + 25*x7 + 1)^2


Below the entries of the matrix M:

sage: [[M[i][j] for j in range(8)] for i in range(8)]
[[1/x2 + 1/x3 + 1/x4 + 8/x5 + 27/x7 + 1,
1/x2 + 1/x3 + 1/x4 + 4/x5 + 9/x7,
1/x2 + 1/x3 + 1/x4 + 4/x5 + 9/x7,
1/x2 + 1/x3 + 1/x4 + 2/x5 + 3/x7,
1/x2 + 1/x3 + 1/x4 + 4/x5 + 9/x7,
1/x2 + 1/x3 + 1/x4 + 2/x5 + 3/x7,
1/x2 + 1/x3 + 1/x4 + 2/x5 + 3/x7,
1/x2 + 1/x3 + 1/x4 + 1/x5 + 27/x6 + 1/x7],
[1/x2 + 1/x3 + 1/x4 + 4/x5 + 9/x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 + 1/x3 + 1/x4 + 8/x5 + 1/x6 + 8/x7 + 1]]

edit retag close merge delete

Works for me in sage 9.5.beta6:

sage: bla.denominator()
x2*x3*x4*x5^8*x6^8*x7^8
sage: bla.factor().denominator()
x2*x3*x4*x5^8*x6^8*x7^8

( 2022-03-27 10:34:40 +0200 )edit

I can't reproduce your M. After running :

M1=identity_matrix(2)
M2=matrix([[1,1],[1,1]])
M3=matrix([[1,1],[1,1]])
M4=matrix([[1,1],[1,1]])
M5=matrix([[2,1],[1,2]])
M6=matrix([[0,3],[3,1]])
M7=matrix([[3,1],[1,2]])
L=[M1,M2,M3,M4,M5,M6,M7]
var('x2,x3,x4,x5,x6,x7')
dim=[1,x2,x3,x4,x5,x6,x7]
MyM=sum((L[i].tensor_product(L[i])).tensor_product(L[i])/(dim[i]) for i in range(7))


I get :

sage: MyM.dimensions()
(8, 8)


BTW :

sage: list(((L[u].tensor_product(L[u]).tensor_product(L[u])/(dim[u])).dimensions() for u in range(7)))
[(8, 8), (8, 8), (8, 8), (8, 8), (8, 8), (8, 8), (8, 8)]


FWIW :

sage: (L[0].tensor_product(L[0])).dimensions()
(4, 4)
sage: (L[0].tensor_product(L[0]).tensor_product(L[0])).dimensions()
(8, 8)

( 2022-03-27 10:57:25 +0200 )edit

Okay, I was misled by your presentation of your M matrix, which gives M but the last row and column... Your quoted Mis equal to MyM[:7,:7].

I get the same results as FredericC.

BTW :

sage: %time MyM[:7,:7].det().denominator()
CPU times: user 3.5 s, sys: 0 ns, total: 3.5 s
Wall time: 3.5 s
x2*x3*x4*x5^7*x6^6*x7^7
sage: %time MyM[:7,:7].det().factor().denominator()
CPU times: user 3.71 s, sys: 20 µs, total: 3.71 s
Wall time: 3.71 s
x2*x3*x4*x5^7*x6^6*x7^7


What Sage are you using (version, platform, how did you install ?)

( 2022-03-27 11:44:30 +0200 )edit

@FrédéricC Yes it is 8, not 7 (I edited it). That does not fix the problem.

( 2022-03-27 13:17:43 +0200 )edit

@Emmanuel Charpentier SageMath version 9.2, Release Date: 2020-10-24, Windows 10, I installed it from https://www.sagemath.org/download.html

( 2022-03-27 13:29:59 +0200 )edit

Sort by » oldest newest most voted

Fixed by installing SageMath 9.3.

more