Ask Your Question

Revision history [back]

Here's a way to do the elimination properly:

R = PolynomialRing(QQ, names=['a','b','c','d','e','f','g'] + [f'm_{i}{j}' for i in range(4) for j in range(4)])
a,b,c,d,e,f,g = R.gens()[:7]
N = matrix(R,
   [[a, e, f, g],
    [e, b, 0, 0],
    [f, 0, c, 0],
    [g, 0, 0, d]]
)
M = matrix(R, 4, 4, R.gens()[7:])
I = R.ideal((M*N - identity_matrix(R,4,4)).list())
J = I.elimination_ideal([a,b,c,d,e,f,g])
J.gens()

Output:

[m_23 - m_32, m_13 - m_31, m_12 - m_21, m_03 - m_30, m_02 - m_20, m_01 - m_10, m_20*m_31 - m_10*m_32, m_21*m_30 - m_10*m_32, m_20*m_30 - m_00*m_32, m_10*m_30 - m_00*m_31, m_10*m_20 - m_00*m_21, m_00*m_21*m_31 - m_10^2*m_32]

I do not have the answer why your way didn't work.

Here's a way to do the elimination properly:

R = PolynomialRing(QQ, names=['a','b','c','d','e','f','g'] + [f'm_{i}{j}' for i in range(4) for j in range(4)])
a,b,c,d,e,f,g = R.gens()[:7]
N = matrix(R,
   [[a, e, f, g],
    [e, b, 0, 0],
    [f, 0, c, 0],
    [g, 0, 0, d]]
)
M = matrix(R, 4, 4, R.gens()[7:])
I = R.ideal((M*N - identity_matrix(R,4,4)).list())
J = I.elimination_ideal([a,b,c,d,e,f,g])
J.gens()

Output:

[m_23 - m_32, m_13 - m_31, m_12 - m_21, m_03 - m_30, m_02 - m_20, m_01 - m_10, m_20*m_31 - m_10*m_32, m_21*m_30 - m_10*m_32, m_20*m_30 - m_00*m_32, m_10*m_30 - m_00*m_31, m_10*m_20 - m_00*m_21, m_00*m_21*m_31 - m_10^2*m_32]

And here's the way to fix your attempt, making the determinant invertible:

R = PolynomialRing(QQ, names=['a','b','c','d','e','f','g'] + [f'm_{i}{j}' for i in range(4) for j in range(4)] + ['det_N_inv'])
a,b,c,d,e,f,g = R.gens()[:7]
N = matrix(R,
   [[a, e, f, g],
    [e, b, 0, 0],
    [f, 0, c, 0],
    [g, 0, 0, d]]
)
det_N_inv = R.gens()[-1]
M = matrix(R, 4, 4, R.gens()[7:-1])
I do not have the answer why your way didn't work.

= R.ideal((M - N.inverse()).apply_map(numerator).list() + [N.det()*det_N_inv - 1]) J = I.elimination_ideal([a,b,c,d,e,f,g,det_N_inv]) J.gens()

Here's a way to do the elimination properly:

R = PolynomialRing(QQ, names=['a','b','c','d','e','f','g'] + [f'm_{i}{j}' for i in range(4) for j in range(4)])
a,b,c,d,e,f,g = R.gens()[:7]
N = matrix(R,
   [[a, e, f, g],
    [e, b, 0, 0],
    [f, 0, c, 0],
    [g, 0, 0, d]]
)
M = matrix(R, 4, 4, R.gens()[7:])
I = R.ideal((M*N - identity_matrix(R,4,4)).list())
J = I.elimination_ideal([a,b,c,d,e,f,g])
J.gens()

Output:

[m_23 - m_32, m_13 - m_31, m_12 - m_21, m_03 - m_30, m_02 - m_20, m_01 - m_10, m_20*m_31 - m_10*m_32, m_21*m_30 - m_10*m_32, m_20*m_30 - m_00*m_32, m_10*m_30 - m_00*m_31, m_10*m_20 - m_00*m_21, m_00*m_21*m_31 - m_10^2*m_32]

And here's the way to fix your attempt, making the determinant invertible:

R = PolynomialRing(QQ, names=['a','b','c','d','e','f','g'] + [f'm_{i}{j}' for i in range(4) for j in range(4)] + ['det_N_inv'])
a,b,c,d,e,f,g = R.gens()[:7]
N = matrix(R,
   [[a, e, f, g],
    [e, b, 0, 0],
    [f, 0, c, 0],
    [g, 0, 0, d]]
)
det_N_inv = R.gens()[-1]
M = matrix(R, 4, 4, R.gens()[7:-1])
I = R.ideal((M - N.inverse()).apply_map(numerator).list() + [N.det()*det_N_inv - 1])
J = I.elimination_ideal([a,b,c,d,e,f,g,det_N_inv])
J.gens()

Output:

[m_23 - m_32, m_13 - m_31, m_12 - m_21, m_03 - m_30, m_02 - m_20, m_01 - m_10, m_20*m_31 - m_10*m_32, m_21*m_30 - m_10*m_32, m_20*m_30 - m_00*m_32, m_10*m_30 - m_00*m_31, m_10*m_20 - m_00*m_21, m_00*m_21*m_31 - m_10^2*m_32]