| 1 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 10. Mengenlehre in GEL</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><link rel="home" href="index.html" title="Genius-Handbuch"><link rel="up" href="index.html" title="Genius-Handbuch"><link rel="prev" href="ch09.html" title="Chapter 9. Polynome in GEL"><link rel="next" href="ch11.html" title="Chapter 11. Liste der GEL-Funktionen"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 10. Mengenlehre in GEL</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch09.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch11.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="genius-gel-settheory"></a>Chapter 10. Mengenlehre in GEL</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="sect1"><a href="ch10.html#genius-gel-sets-using">Mengen verwenden</a></span></dt></dl></div><p lang="en"> |
| 2 | Genius has some basic set theoretic functionality built in. Currently a set is |
| 3 | just a vector (or a matrix). Every distinct object is treated as a different element. |
| 4 | </p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="genius-gel-sets-using"></a>Mengen verwenden</h2></div></div></div><p lang="en"> |
| 5 | Just like vectors, objects |
| 6 | in sets can include numbers, strings, <code class="constant">null</code>, matrices and vectors. It is |
| 7 | planned in the future to have a dedicated type for sets, rather than using vectors. |
| 8 | Note that floating point numbers are distinct from integers, even if they appear the same. |
| 9 | That is, Genius will treat <code class="constant">0</code> and <code class="constant">0.0</code> |
| 10 | as two distinct elements. The <code class="constant">null</code> is treated as an empty set. |
| 11 | </p><p lang="en"> |
| 12 | To build a set out of a vector, use the |
| 13 | <a class="link" href="ch11s16.html#gel-function-MakeSet"><code class="function">MakeSet</code></a> function. |
| 14 | Currently, it will just return a new vector where every element is unique. |
| 15 | </p><pre lang="en" class="screen"><code class="prompt">genius> </code><strong class="userinput"><code>MakeSet([1,2,2,3])</code></strong> |
| 16 | = [1, 2, 3] |
| 17 | </pre><p lang="en"> |
| 18 | </p><p lang="en"> |
| 19 | Similarly there are functions |
| 20 | <a class="link" href="ch11s16.html#gel-function-Union"><code class="function">Union</code></a>, |
| 21 | <a class="link" href="ch11s16.html#gel-function-Intersection"><code class="function">Intersection</code></a>, |
| 22 | <a class="link" href="ch11s16.html#gel-function-SetMinus"><code class="function">SetMinus</code></a>, which |
| 23 | are rather self explanatory. For example: |
| 24 | </p><pre lang="en" class="screen"><code class="prompt">genius> </code><strong class="userinput"><code>Union([1,2,3], [1,2,4])</code></strong> |
| 25 | = [1, 2, 4, 3] |
| 26 | </pre><p lang="en"> |
| 27 | Note that no order is guaranteed for the return values. If you wish to sort the vector you |
| 28 | should use the |
| 29 | <a class="link" href="ch11s08.html#gel-function-SortVector"><code class="function">SortVector</code></a> function. |
| 30 | </p><p lang="en"> |
| 31 | For testing membership, there are functions |
| 32 | <a class="link" href="ch11s16.html#gel-function-IsIn"><code class="function">IsIn</code></a> and |
| 33 | <a class="link" href="ch11s16.html#gel-function-IsSubset"><code class="function">IsSubset</code></a>, |
| 34 | which return a boolean value. For example: |
| 35 | </p><pre lang="en" class="screen"><code class="prompt">genius> </code><strong class="userinput"><code>IsIn (1, [0,1,2])</code></strong> |
| 36 | = true |
| 37 | </pre><p lang="en"> |
| 38 | The input <strong class="userinput"><code>IsIn(x,X)</code></strong> is equivalent to |
| 39 | <strong class="userinput"><code>IsSubset([x],X)</code></strong>. Note that since the empty set is a subset |
| 40 | of every set, <strong class="userinput"><code>IsSubset(null,X)</code></strong> is always true. |
| 41 | </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch09.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch11.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 9. Polynome in GEL </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 11. Liste der GEL-Funktionen</td></tr></table></div></body></html> |