File: ch10.html

package info (click to toggle)
genius 1.0.27-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 25,308 kB
  • sloc: ansic: 75,620; xml: 71,565; sh: 4,445; makefile: 1,927; lex: 523; yacc: 298; perl: 54
file content (31 lines) | stat: -rw-r--r-- 4,801 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 10. Teoría de conjuntos en GEL</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><link rel="home" href="index.html" title="Manual de Genius"><link rel="up" href="index.html" title="Manual de Genius"><link rel="prev" href="ch09.html" title="Chapter 9. Polinomios en GEL"><link rel="next" href="ch11.html" title="Chapter 11. Lista de funciones GEL"></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. Teoría de conjuntos en 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. Teoría de conjuntos en 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">Usar conjuntos</a></span></dt></dl></div><p>Genius incorpora un juego básico de funcionalidades teoréticas. En la actualidad, un conjunto es sólo un vector (o una matriz). Cada objeto distinto se trata como un elemento diferente.</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="genius-gel-sets-using"></a>Usar conjuntos</h2></div></div></div><p>Al igual que los vectores, los objetos en conjuntos pueden incluir números, cadenas, <code class="constant">null</code>, matrices y vectores. En un futuro se plantea tener un tipo determinado de conjuntos, en lugar de utilizar vectores. Tenga en cuenta que los números en coma flotante son distintos de los enteros, y que parecen iguales. Esto significa que Genius los tratará como términos distintos, usando las constantes <code class="constant">0</code> y <code class="constant">0.0</code>. La constante <code class="constant">null</code> se trata como un conjunto vacío.</p><p lang="en">
	To build a set out of a vector, use the 
	<a class="link" href="ch11s16.html#gel-function-MakeSet"><code class="function">MakeSet</code></a> function.
	Currently, it will just return a new vector where every element is unique.
</p><pre lang="en" class="screen"><code class="prompt">genius&gt; </code><strong class="userinput"><code>MakeSet([1,2,2,3])</code></strong>
= [1, 2, 3]
</pre><p lang="en">
</p><p lang="en">
	Similarly there are functions 
	<a class="link" href="ch11s16.html#gel-function-Union"><code class="function">Union</code></a>,
	<a class="link" href="ch11s16.html#gel-function-Intersection"><code class="function">Intersection</code></a>,
	<a class="link" href="ch11s16.html#gel-function-SetMinus"><code class="function">SetMinus</code></a>, which
	are rather self explanatory.  For example:
</p><pre lang="en" class="screen"><code class="prompt">genius&gt; </code><strong class="userinput"><code>Union([1,2,3], [1,2,4])</code></strong>
= [1, 2, 4, 3]
</pre><p lang="en">
	Note that no order is guaranteed for the return values.  If you wish to sort the vector you
should use the
	<a class="link" href="ch11s08.html#gel-function-SortVector"><code class="function">SortVector</code></a> function.
	</p><p lang="en">
	  For testing membership, there are functions
	<a class="link" href="ch11s16.html#gel-function-IsIn"><code class="function">IsIn</code></a> and
	<a class="link" href="ch11s16.html#gel-function-IsSubset"><code class="function">IsSubset</code></a>,
	which return a boolean value.  For example:
</p><pre lang="en" class="screen"><code class="prompt">genius&gt; </code><strong class="userinput"><code>IsIn (1, [0,1,2])</code></strong>
= true
</pre><p lang="en">
	The input <strong class="userinput"><code>IsIn(x,X)</code></strong> is equivalent to
	<strong class="userinput"><code>IsSubset([x],X)</code></strong>.  Note that since the empty set is a subset
	of every set, <strong class="userinput"><code>IsSubset(null,X)</code></strong> is always true.
	</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. Polinomios en 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. Lista de funciones GEL</td></tr></table></div></body></html>