# Revision history [back]

Depending on your applications, a direct use of elimination theory might be more insightful. One can write your equations entirely in terms of polynomials if we allow ourselves to clear denominators and express things in terms of $d1^2,d2^2$:

R.<d1, d2, xm, xs, zs, z2, x, y, z, em, es>=PolynomialRing(QQ)
equations = [
d1^2- (xm*xm + zs*zs),
d2^2- (z2*z2 + xs*xs),
xm + xs - x,
zs + z2 - z,
(xm*z2)*es - em*zs*xs]
I=R.ideal(equations)


We can then determine which relations exist between these variables that do not involve $xm,xs,z2$:

d1rel=I.elimination_ideal([xm,xs,z2,d2]).gens(); assert len(d1rel) == 1
assert d1rel[0].coefficient(d1) == 0
d1sqr = - d1rel[0].coefficient({d1:0})/d1rel[0].coefficient({d1:2})

d2rel=I.elimination_ideal([xm,xs,z2,d1]).gens(); assert len(d2rel) == 1
assert d2rel[0].coefficient(d2) == 0
d2sqr = - d2rel[0].coefficient({d2:0})/d2rel[0].coefficient({d2:2})


(by specifying d2 as one of the variables to eliminate, we know we'll get relations that do NOT involve d2). We can easily test that we only find one relation, that it is of degree 2 in d1 and that it does not mention d1 linearly. So we can easily get the value of d1^2 out of that. Same thing for d2)

It looks like for your example, symbolics are just fine -- and perhaps a bit better, since they don't necessarily multiply out every polynomial. For more involved elimination problems, however, direct use of groebner-basis based methods becomes indispensible.