Sophie

Sophie

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

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>Set -- the class of all sets</title>
<link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/>
</head>
<body>
<table class="buttons">
  <tr>
    <td><div><a href="_set.html">next</a> | <a href="_separate__Regexp_lp__String_cm__Z__Z_cm__String_rp.html">previous</a> | <a href="_set.html">forward</a> | <a href="_separate__Regexp_lp__String_cm__Z__Z_cm__String_rp.html">backward</a> | up | <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>
<hr/>
<div><h1>Set -- the class of all sets</h1>
<div class="single"><h2>Description</h2>
<div>Elements of sets may be any immutable object, such as integers, ring elements and lists of such.  Ideals may also be elements of sets.<table class="examples"><tr><td><pre>i1 : A = set {1,2};</pre>
</td></tr>
<tr><td><pre>i2 : R = QQ[a..d];</pre>
</td></tr>
<tr><td><pre>i3 : B = set{a^2-b*c,b*d}

                2
o3 = set {b*d, a  - b*c}

o3 : Set</pre>
</td></tr>
</table>
Set operations, such as <a href="_member.html">membership</a>, <a href="___Set_sp_pl_sp__Set.html">union</a>, <a href="___Set_sp_st_sp__Set.html">intersection</a>, <a href="___Set_sp-_sp__Set.html">difference</a>, <a href="___Set_sp_st_st_sp__Set.html">Cartesian product</a>, <a href="___Tally_sp^_st_st_sp__Z__Z.html">Cartesian power</a>, and <a href="_is__Subset_lp__Set_cm__Set_rp.html">subset</a> are available. For example,<table class="examples"><tr><td><pre>i4 : toList B

            2
o4 = {b*d, a  - b*c}

o4 : List</pre>
</td></tr>
<tr><td><pre>i5 : member(1,A)

o5 = true</pre>
</td></tr>
<tr><td><pre>i6 : member(-b*c+a^2,B)

o6 = true</pre>
</td></tr>
<tr><td><pre>i7 : A ** A

o7 = set {(1, 1), (1, 2), (2, 1), (2, 2)}

o7 : Set</pre>
</td></tr>
<tr><td><pre>i8 : A^**2

o8 = set {(1, 1), (1, 2), (2, 1), (2, 2)}

o8 : Set</pre>
</td></tr>
<tr><td><pre>i9 : set{1,3,2} - set{1}

o9 = set {2, 3}

o9 : Set</pre>
</td></tr>
<tr><td><pre>i10 : set{4,5} + set{5,6}

o10 = set {4, 5, 6}

o10 : Set</pre>
</td></tr>
<tr><td><pre>i11 : set{4,5} * set{5,6}

o11 = set {5}

o11 : Set</pre>
</td></tr>
<tr><td><pre>i12 : set{1,3,2} === set{1,2,3}

o12 = true</pre>
</td></tr>
</table>
<p/>
<a href="___Ideal.html">Ideals</a> in Macaulay2 come equipped with a specific sequence of generators, so the following two ideals are not considered strictly equal, and thus the set containing them will appear to have two elements.<table class="examples"><tr><td><pre>i13 : I = ideal(a,b); J = ideal(b,a);

o13 : Ideal of R

o14 : Ideal of R</pre>
</td></tr>
<tr><td><pre>i15 : I == J

o15 = true</pre>
</td></tr>
<tr><td><pre>i16 : I === J

o16 = false</pre>
</td></tr>
<tr><td><pre>i17 : C = set(ideal(a,b),ideal(b,a))

o17 = set {ideal (a, b), ideal (b, a)}

o17 : Set</pre>
</td></tr>
</table>
However, if you <a href="_trim.html" title="minimize generators and relations">trim</a> the ideals, then the generating sets will be the same, and so the set containing them will have one element.<table class="examples"><tr><td><pre>i18 : C1 = set(trim ideal(a,b),trim ideal(b,a))

o18 = set {ideal (b, a)}

o18 : Set</pre>
</td></tr>
</table>
<p/>
A set is implemented as a <a href="___Hash__Table.html" title="the class of all hash tables">HashTable</a>, whose keys are the elements of the set, and whose values are all 1.  In particular, this means that two objects are considered the same exactly when they are strictly equal, according to <a href="___Thing_sp_eq_eq_eq_sp__Thing.html" title="strict equality">===</a>.</div>
</div>
<div class="waystouse"><h2>Functions and methods returning a set :</h2>
<ul><li><span>set(VisibleList), see <span><a href="_set.html" title="make a set">set</a> -- make a set</span></span></li>
<li><span><a href="___Set_sp_st_sp__Set.html" title="intersection of sets">Set * Set</a> -- intersection of sets</span></li>
<li><span><a href="___Set_sp_st_st_sp__Set.html" title="Cartesian product">Set ** Set</a> -- Cartesian product</span></li>
<li><span><a href="___Set_sp_pl_sp__Set.html" title="set union">Set + Set</a> -- set union</span></li>
<li><span>Set - List, see <span><a href="___Set_sp-_sp__Set.html" title="set difference">Set - Set</a> -- set difference</span></span></li>
<li><span><a href="___Set_sp-_sp__Set.html" title="set difference">Set - Set</a> -- set difference</span></li>
</ul>
<h2>Methods that use a set :</h2>
<ul><li><span><a href="__sh_sp__Set.html" title="cardinality"># Set</a> -- cardinality</span></li>
<li><span>commonest(Set), see <span><a href="_commonest.html" title="the most common elements of a list or tally">commonest</a> -- the most common elements of a list or tally</span></span></li>
<li><span>elements(Set), see <span><a href="_elements.html" title="list of elements">elements</a> -- list of elements</span></span></li>
<li><span><a href="_is__Subset_lp__Set_cm__Set_rp.html" title="whether one object is a subset of another">isSubset(Set,Set)</a> -- whether one object is a subset of another</span></li>
<li><span>isSubset(Set,VisibleList), see <span><a href="_is__Subset_lp__Set_cm__Set_rp.html" title="whether one object is a subset of another">isSubset(Set,Set)</a> -- whether one object is a subset of another</span></span></li>
<li><span>isSubset(VisibleList,Set), see <span><a href="_is__Subset_lp__Set_cm__Set_rp.html" title="whether one object is a subset of another">isSubset(Set,Set)</a> -- whether one object is a subset of another</span></span></li>
<li><span>member(Thing,Set), see <span><a href="_member.html" title="test membership in a list or set">member</a> -- test membership in a list or set</span></span></li>
<li><span><a href="_product_lp__Set_rp.html" title="product of elements">product(Set)</a> -- product of elements</span></li>
<li><span><a href="___Set_sp_sh_qu_sp__Thing.html" title="test set membership">Set #? Thing</a> -- test set membership</span></li>
<li><span>List - Set, see <span><a href="___Set_sp-_sp__Set.html" title="set difference">Set - Set</a> -- set difference</span></span></li>
<li><span><a href="_subsets_lp__Set_rp.html" title="produce all the subsets">subsets(Set)</a> -- produce all the subsets</span></li>
<li><span><a href="_subsets_lp__Set_cm__Z__Z_rp.html" title="produce all the subsets">subsets(Set,ZZ)</a> -- produce all the subsets</span></li>
<li><span><a href="_sum_lp__Set_rp.html" title="sum of elements">sum(Set)</a> -- sum of elements</span></li>
<li><span><a href="_to__List_lp__Set_rp.html" title="list of elements">toList(Set)</a> -- list of elements</span></li>
</ul>
</div>
<div class="waystouse"><h2>For the programmer</h2>
<p>The object <a href="___Set.html" title="the class of all sets">Set</a> is <span>a <a href="___Type.html">type</a></span>, with ancestor classes <a href="___Tally.html" title="the class of all tally results">Tally</a> &lt; <a href="___Hash__Table.html" title="the class of all hash tables">HashTable</a> &lt; <a href="___Thing.html" title="the class of all things">Thing</a>.</p>
</div>
</div>
</body>
</html>