<?xml version="1.0" encoding="utf-8" ?> <!-- for emacs: -*- coding: utf-8 -*- --> <!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head><title>equality and containment</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_extracting_spgenerators_spof_span_spideal.html">next</a> | <a href="_sums_cm_spproducts_cm_spand_sppowers_spof_spideals.html">previous</a> | <a href="_extracting_spgenerators_spof_span_spideal.html">forward</a> | <a href="_sums_cm_spproducts_cm_spand_sppowers_spof_spideals.html">backward</a> | <a href="_ideals.html">up</a> | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div> </td> </tr> </table> <div><a href="index.html" title="">Macaulay2Doc</a> > <a href="_ideals.html" title="">ideals</a> > <a href="_equality_spand_spcontainment.html" title="">equality and containment</a></div> <hr/> <div><h1>equality and containment</h1> <div>Equality and containment between two ideals in a polynomial ring (or quotient of a polynomial ring) is checked by comparing their respective Groebner bases.<h2>equal and not equal</h2> Use <a href="__eq_eq.html" title="equality">Ideal == Ideal</a> to test if two ideals in the same ring are equal.<table class="examples"><tr><td><pre>i1 : R = QQ[a..d];</pre> </td></tr> <tr><td><pre>i2 : I = ideal (a^2*b-c^2, a*b^2-d^3, c^5-d); o2 : Ideal of R</pre> </td></tr> <tr><td><pre>i3 : J = ideal (a^2,b^2,c^2,d^2); o3 : Ideal of R</pre> </td></tr> <tr><td><pre>i4 : I == J o4 = false</pre> </td></tr> <tr><td><pre>i5 : I != J o5 = true</pre> </td></tr> </table> <h2>normal form with respect to a Groebner basis and membership</h2> The function <a href="_methods_spfor_spnormal_spforms_spand_spremainder.html" title="calculate the normal form of ring elements and matrices">RingElement % Ideal</a> reduces an element with respect to a Groebner basis of the ideal.<table class="examples"><tr><td><pre>i6 : (1+a+a^3+a^4) % J o6 = a + 1 o6 : R</pre> </td></tr> </table> We can then test membership in the ideal by comparing the answer to 0 using <a href="__eq_eq.html" title="equality">==</a>.<table class="examples"><tr><td><pre>i7 : (1+a+a^3+a^4) % J == 0 o7 = false</pre> </td></tr> <tr><td><pre>i8 : a^4 % J == 0 o8 = true</pre> </td></tr> </table> <h2>containment for two ideals</h2> Containment for two ideals is tested using <a href="_is__Subset.html" title="whether one object is a subset of another">isSubset</a>.<table class="examples"><tr><td><pre>i9 : isSubset(I,J) o9 = false</pre> </td></tr> <tr><td><pre>i10 : isSubset(I,I+J) o10 = true</pre> </td></tr> <tr><td><pre>i11 : isSubset(I+J,I) o11 = false</pre> </td></tr> </table> <h2>ideal equal to 1 or 0</h2> Use the expression <tt>I == 1</tt> to see if the ideal is equal to the ring. Use <tt>I == 0</tt> to see if the ideal is identically zero in the given ring.<table class="examples"><tr><td><pre>i12 : I = ideal (a^2-1,a^3+3); o12 : Ideal of R</pre> </td></tr> <tr><td><pre>i13 : I == 1 o13 = true</pre> </td></tr> <tr><td><pre>i14 : S = R/I o14 = S o14 : QuotientRing</pre> </td></tr> <tr><td><pre>i15 : S == 0 o15 = true</pre> </td></tr> </table> </div> <div class="single"><h2>See also</h2> <ul><li><span><a href="__eq_eq.html" title="equality">Ideal == Ideal</a> -- equality</span></li> <li><span><a href="__eq_eq.html" title="equality">Ideal == ZZ</a> -- equality</span></li> <li><span><a href="_!_eq.html" title="inequality">!=</a> -- inequality</span></li> <li><span><a href="_methods_spfor_spnormal_spforms_spand_spremainder.html" title="calculate the normal form of ring elements and matrices">RingElement % Ideal</a> -- calculate the normal form of ring elements and matrices</span></li> <li><span><a href="_is__Subset_lp__Ideal_cm__Ideal_rp.html" title="whether one object is a subset of another">isSubset(Ideal,Ideal)</a> -- whether one object is a subset of another</span></li> </ul> </div> </div> </body> </html>