Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here is an example using the avatar of ideals in polynomial rings, algorithms are using Gröbner bases or related techniques. Let us consider the system: $$ \left{ \begin{aligned} x^2+y^2+z^2 &= 14\ ,\ xy+yz+zx &= 11\ ,\ xyz - y^2 &= 2\ . \end{aligned} \right. $$ So we associate the ideal generated by "these equations" inside the ring $\Bbb Q[x,y,z]$, and ask for partial eliminations. For instance:

R.<x,y,z> = PolynomialRing(QQ)
gens = [ x^2 + y^2 + z^2 - 14, x*y + y*z + z*x -11, x*y*z - y^2 -2]
J = R.ideal(gens)
J.elimination_ideal([x,y])

And we get as result of the last elimination, here explicitly required once more in the ipython sage console:

sage: J.elimination_ideal([x, y])                                                                                                                             
Ideal (z^12 + 2*z^11 - 25*z^10 - 40*z^9 + 329*z^8 - 4*z^7 - 1763*z^6 
        + 3984*z^5 + 2475*z^4 - 43722*z^3 + 75942*z^2 - 60588*z + 23409) 
of Multivariate Polynomial Ring in x, y, z over Rational Field

(Result was manually rearranged to fit in the landscape.)

We can ask for the factorization of the above polynomial:

sage: J.elimination_ideal([x, y]).gens()[0].factor()                                                                                                          
(z - 3) * (z - 1) * (z^4 - 7*z^3 + 22*z^2 - 42*z + 51) * (z^6 + 13*z^5 + 65*z^4 + 137*z^3 + 69*z^2 - 66*z + 153)

So we already expect solutions of the given equations having $z=1$, and/or having $z=3$. Since the associated variety is a set of points, we can ask for this points:

sage: J.variety()                                                                                                                                             
[{z: 3, y: 2, x: 1}, {z: 1, y: 2, x: 3}]

We can also ask for partial eliminations of one variable:

J.elimination_ideal([x]) 
J.elimination_ideal([y]) 
J.elimination_ideal([z])

The same works also in the case we have "fewer equations". For instance:

J = R * [ x^2 + y^2 + z^2 - 1, x*y + y*z + z*x - 3]
print( f"J is {J}" )
J.elimination_ideal(z)

And we obtain:

J is Ideal (x^2 + y^2 + z^2 - 1, x*y + x*z + y*z - 3)
    of Multivariate Polynomial Ring in x, y, z over Rational Field
Ideal (x^4 + 2*x^3*y + 3*x^2*y^2 + 2*x*y^3 + y^4 - x^2 - 8*x*y - y^2 + 9)
    of Multivariate Polynomial Ring in x, y, z over Rational Field

Here is an example using the avatar of ideals in polynomial rings, algorithms are using Gröbner bases or related techniques. Let us consider the system: $$ \left{ \left\{ \begin{aligned} x^2+y^2+z^2 &= 14\ ,\ ,\\ xy+yz+zx &= 11\ ,\ ,\\ xyz - y^2 &= 2\ . \end{aligned} \right. $$ So we associate the ideal generated by "these equations" inside the ring $\Bbb Q[x,y,z]$, and ask for partial eliminations. For instance:

R.<x,y,z> = PolynomialRing(QQ)
gens = [ x^2 + y^2 + z^2 - 14, x*y + y*z + z*x -11, x*y*z - y^2 -2]
J = R.ideal(gens)
J.elimination_ideal([x,y])

And we get as result of the last elimination, here explicitly required once more in the ipython sage console:

sage: J.elimination_ideal([x, y])                                                                                                                             
Ideal (z^12 + 2*z^11 - 25*z^10 - 40*z^9 + 329*z^8 - 4*z^7 - 1763*z^6 
        + 3984*z^5 + 2475*z^4 - 43722*z^3 + 75942*z^2 - 60588*z + 23409) 
of Multivariate Polynomial Ring in x, y, z over Rational Field

(Result was manually rearranged to fit in the landscape.)

We can ask for the factorization of the above polynomial:

sage: J.elimination_ideal([x, y]).gens()[0].factor()                                                                                                          
(z - 3) * (z - 1) * (z^4 - 7*z^3 + 22*z^2 - 42*z + 51) * (z^6 + 13*z^5 + 65*z^4 + 137*z^3 + 69*z^2 - 66*z + 153)

So we already expect solutions of the given equations having $z=1$, and/or having $z=3$. Since the associated variety is a set of points, we can ask for this points:

sage: J.variety()                                                                                                                                             
[{z: 3, y: 2, x: 1}, {z: 1, y: 2, x: 3}]

We can also ask for partial eliminations of one variable:

J.elimination_ideal([x]) 
J.elimination_ideal([y]) 
J.elimination_ideal([z])

The same works also in the case we have "fewer equations". For instance:

J = R * [ x^2 + y^2 + z^2 - 1, x*y + y*z + z*x - 3]
print( f"J is {J}" )
J.elimination_ideal(z)

And we obtain:

J is Ideal (x^2 + y^2 + z^2 - 1, x*y + x*z + y*z - 3)
    of Multivariate Polynomial Ring in x, y, z over Rational Field
Ideal (x^4 + 2*x^3*y + 3*x^2*y^2 + 2*x*y^3 + y^4 - x^2 - 8*x*y - y^2 + 9)
    of Multivariate Polynomial Ring in x, y, z over Rational Field