Hi! I'm trying to compute the polynomial relations among matrix entries:
Here is the setup:
# the following codes are from python with sagemath
a, b, c, d, e, f, g = var('a b c d e f g')
N = Matrix(SR,
[[a, e, f, g],
[e, b, 0, 0],
[f, 0, c, 0],
[g, 0, 0, d]]
)
M = N.inverse()
For the symmetric matrix N with the above zero patterns, we notice that the following relations should hold in its inverse, and indeed we verified them:
# below all passed assert M[0, 0] * M[1, 2] * M[1, 3] - M[0, 1] ** 2 * M[2, 3] == 0 assert M[0, 1] * M[0, 2] - M[0, 0] * M[1, 2] == 0 assert M[0, 1] * M[0, 3] - M[0, 0] * M[1, 3] == 0 assert M[0, 2] * M[0, 3] - M[0, 0] * M[2, 3] == 0 assert M[0, 3] * M[1, 2] - M[0, 1] * M[2, 3] == 0 assert M[0, 2] * M[1, 3] - M[0, 1] * M[2, 3] == 0
Then, I tried to see if these relations can be found automatically by elimination:
tag_variable_names = [f'M_{i}_{j}' for i in range(4) for j in range(i, 4)]
R = PolynomialRing(QQ, tag_variable_names + ['a', 'b', 'c', 'd', 'e', 'f', 'g'])
R_gens = R.gens_dict()
param_symbolic_to_ring = {v: R_gens[str(v)] for v in [a, b, c, d, e, f, g]}
equations = []
for i in range(4):
for j in range(i, 4):
true_expr = M[i, j].subs(param_symbolic_to_ring)
# this true expression is fraction of polynomials w.r.t. parameters a, b, c, ..., and can be very complicated
# we clear the denominator as follows:
numerator, denominator = true_expr.numerator(), true_expr.denominator()
equations.append(R_gens[f'M_{i}_{j}'] * denominator - R(numerator))
I = R.ideal(equations)
# to get the relations among tag variables (entries of M), we eliminate the parameters
J = I.elimination_ideal(list(param_symbolic_to_ring.values()))
Ideal_M = J.change_ring(PolynomialRing(QQ, tag_variable_names))
I expect that the elimination ideal should contain the above relations. However, nothing was found:
> Ideal_M.gens() [0]
Why does this happen? Could it be related to handling fractions during the elimination? Any insights would be appreciated!