Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 7ebd25ac536d248d499a3ce2acda963a > files > 3940

Macaulay2-1.3.1-8.fc15.i686.rpm

<?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</title>
<link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/>
</head>
<body>
<table class="buttons">
  <tr>
    <td><div><a href="_!_eq.html">next</a> | <a href="__lt-.html">previous</a> | <a href="_!_eq.html">forward</a> | <a href="__lt-.html">backward</a> | <a href="_operators.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="___The_sp__Macaulay2_splanguage.html" title="">The Macaulay2 language</a> > <a href="_operators.html" title="">operators</a> > <a href="__eq_eq.html" title="equality">==</a></div>
<hr/>
<div><h1>== -- equality</h1>
<div class="single"><h2>Synopsis</h2>
<ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>x == y</tt></div>
</dd></dl>
</div>
</li>
</ul>
</div>
<div class="single"><h2>Description</h2>
<div><p>Returns true or false, depending on whether the objects x and y are (mathematically) equal.  The objects x and y are typically numbers, elements of rings, matrices, modules, ideals, chain complexes, and so on.</p>
<p>A test for mathematical equality will typically involve doing a computation to see whether two representations of the same mathematical object are being compared.  For example, an ideal in a ring is represented by giving its generators, and checking whether two sets of generators produce the same ideal involves a computation with Gröbner bases.  The ideals must be defined in the same ring.</p>
<h3>Ideals</h3>
<table class="examples"><tr><td><pre>i1 : R = QQ[a,b,c];</pre>
</td></tr>
<tr><td><pre>i2 : ideal(a^2-b,a^3) == ideal(b^2, a*b, a^2-b)

o2 = true</pre>
</td></tr>
</table>
<p>Often mathematical objects can be tested to see if they are 0 or 1.</p>
<table class="examples"><tr><td><pre>i3 : L = ideal(a^2-a-1,a^3+a+3)

             2           3
o3 = ideal (a  - a - 1, a  + a + 3)

o3 : Ideal of R</pre>
</td></tr>
<tr><td><pre>i4 : L == 1

o4 = true</pre>
</td></tr>
<tr><td><pre>i5 : L == 0

o5 = false</pre>
</td></tr>
</table>
<h3>Matrices</h3>
<p>Two <a href="_matrices.html" title="">matrices</a> are equal if their entries are equal, the source and target are the same (including degrees), and the degree of the matrices are the same.  In this example, m and n have different source free modules.</p>
<table class="examples"><tr><td><pre>i6 : m = matrix{{a,b},{c,a}}

o6 = | a b |
     | c a |

             2       2
o6 : Matrix R  &lt;--- R</pre>
</td></tr>
<tr><td><pre>i7 : n = map(R^2,R^2,m)

o7 = | a b |
     | c a |

             2       2
o7 : Matrix R  &lt;--- R</pre>
</td></tr>
<tr><td><pre>i8 : m == n

o8 = false</pre>
</td></tr>
<tr><td><pre>i9 : source m == source n

o9 = false</pre>
</td></tr>
</table>
<p>If you only want to know if they have the same entries, test the difference against zero.</p>
<table class="examples"><tr><td><pre>i10 : m-n == 0

o10 = true</pre>
</td></tr>
</table>
<h3>Rings</h3>
<h3>Modules</h3>
<p>Two <a href="_modules.html" title="">modules</a> are equal if they are isomorphic as subquotients of the same ambient free module.</p>
<table class="examples"><tr><td><pre>i11 : image matrix {{2,a},{1,5}} == R^2

o11 = false</pre>
</td></tr>
<tr><td><pre>i12 : image matrix {{2,a},{0,5}} == R^2

o12 = true</pre>
</td></tr>
</table>
<p>It may happen that for certain types of objects, there is no method installed (yet) for testing mathematical equality, in which case an error message will be printed.  A good alternative may be to test for strict equality with the operator <a href="___Thing_sp_eq_eq_eq_sp__Thing.html" title="strict equality">===</a>.</p>
<p>Since various sorts of mathematical objects are implemented as types, i.e., as instances of <a href="___Type.html" title="the class of all types">Type</a>, there is no generic method for checking equality of types, so that new mathematical comparison code can be provided in the future without breaking code that works.</p>
</div>
</div>
<div class="single"><h2>Caveat</h2>
<div>Warning: whether this comparison operator returns true is not necessarily related to whether the comparison operator <a href="__qu.html" title="comparison operator">?</a> returns <tt>symbol ==</tt>.</div>
</div>
<div class="single"><h2>See also</h2>
<ul><li><span><a href="_!_eq.html" title="inequality">!=</a> -- inequality</span></li>
<li><span><a href="___Thing_sp_eq_eq_eq_sp__Thing.html" title="strict equality">===</a> -- strict equality</span></li>
<li><span><a href="__eq!_eq.html" title="strict inequality">=!=</a> -- strict inequality</span></li>
<li><span><a href="_operators.html" title="">operators</a></span></li>
</ul>
</div>
<div class="waystouse"><h2>Ways to use <tt>==</tt> :</h2>
<ul><li>BettiTally == BettiTally</li>
<li>Boolean == Boolean</li>
<li>CC == CC</li>
<li>CC == QQ</li>
<li>CC == RR</li>
<li>CC == ZZ</li>
<li>ChainComplex == ChainComplex</li>
<li>ChainComplex == ZZ</li>
<li>ChainComplexMap == ChainComplexMap</li>
<li>ChainComplexMap == RingElement</li>
<li>ChainComplexMap == ZZ</li>
<li>Equation == Equation</li>
<li>Equation == Expression</li>
<li>Equation == Holder</li>
<li>Expression == Equation</li>
<li>GradedModule == GradedModule</li>
<li>GradedModuleMap == GradedModuleMap</li>
<li>GradedModuleMap == RingElement</li>
<li>GradedModuleMap == ZZ</li>
<li>Holder == Equation</li>
<li>Holder == Holder</li>
<li>Ideal == Ideal</li>
<li>Ideal == Module</li>
<li>Ideal == MonomialIdeal</li>
<li>Ideal == Ring</li>
<li>Ideal == ZZ</li>
<li>InfiniteNumber == InfiniteNumber</li>
<li>InfiniteNumber == ZZ</li>
<li>Matrix == Matrix</li>
<li>Matrix == Number</li>
<li>Matrix == RingElement</li>
<li>Matrix == ZZ</li>
<li>Module == Ideal</li>
<li>Module == Module</li>
<li>Module == ZZ</li>
<li>MonoidElement == MonoidElement</li>
<li>MonomialIdeal == Ideal</li>
<li>MonomialIdeal == MonomialIdeal</li>
<li>MonomialIdeal == Ring</li>
<li>MonomialIdeal == ZZ</li>
<li>MutableMatrix == MutableMatrix</li>
<li>MutableMatrix == ZZ</li>
<li>Net == Net</li>
<li>Net == String</li>
<li>Nothing == Nothing</li>
<li>Number == Matrix</li>
<li>Number == RingElement</li>
<li>ProjectiveHilbertPolynomial == ProjectiveHilbertPolynomial</li>
<li>QQ == CC</li>
<li>QQ == QQ</li>
<li>QQ == RR</li>
<li>QQ == ZZ</li>
<li>Ring == Ideal</li>
<li>Ring == MonomialIdeal</li>
<li>Ring == ZZ</li>
<li>RingElement == ChainComplexMap</li>
<li>RingElement == GradedModuleMap</li>
<li>RingElement == Matrix</li>
<li>RingElement == Number</li>
<li>RingElement == RingElement</li>
<li>RingElement == ZZ</li>
<li>RingMap == ZZ</li>
<li>RR == CC</li>
<li>RR == QQ</li>
<li>RR == RR</li>
<li>RR == ZZ</li>
<li>Sequence == Sequence</li>
<li>String == Net</li>
<li>String == String</li>
<li>Symbol == Symbol</li>
<li>Vector == Vector</li>
<li>VisibleList == VisibleList</li>
<li>ZZ == CC</li>
<li>ZZ == ChainComplex</li>
<li>ZZ == ChainComplexMap</li>
<li>ZZ == GradedModuleMap</li>
<li>ZZ == Ideal</li>
<li>ZZ == InfiniteNumber</li>
<li>ZZ == Module</li>
<li>ZZ == MonomialIdeal</li>
<li>ZZ == MutableMatrix</li>
<li>ZZ == QQ</li>
<li>ZZ == Ring</li>
<li>ZZ == RingElement</li>
<li>ZZ == RingMap</li>
<li>ZZ == RR</li>
<li>ZZ == ZZ</li>
<li><span>Constant == Constant, see <span><a href="___Constant.html" title="">Constant</a></span></span></li>
<li><span>Constant == InexactNumber, see <span><a href="___Constant.html" title="">Constant</a></span></span></li>
<li><span>InexactNumber == Constant, see <span><a href="___Constant.html" title="">Constant</a></span></span></li>
<li><span>Expression == Expression, see <span><a href="___Expression.html" title="the class of all expressions">Expression</a> -- the class of all expressions</span></span></li>
<li><span><tt>InexactNumber == RingElement</tt> (missing documentation<!-- tag: (==,InexactNumber,RingElement) -->)</span></li>
<li><span><tt>RingElement == InexactNumber</tt> (missing documentation<!-- tag: (==,RingElement,InexactNumber) -->)</span></li>
</ul>
</div>
<div class="waystouse"><h2>For the programmer</h2>
<p>The object <a href="__eq_eq.html" title="equality">==</a> is <span>a <a href="___Keyword.html">keyword</a></span>.</p>
<div><div><p>This operator may be used as a binary operator in an expression like <tt>x==y</tt>.  The user may install <a href="_binary_spmethods.html" title="">binary methods</a> for handling such expressions with code such as</p>
<pre>         X == Y := (x,y) -> ...</pre>
<p>where <tt>X</tt> is the class of <tt>x</tt> and <tt>Y</tt> is the class of <tt>y</tt>.</p>
</div>
</div>
</div>
</div>
</body>
</html>