| 1 |
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Básico</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><link rel="home" href="index.html" title="Manual do Genius"><link rel="up" href="ch11.html" title="Chapter 11. List of GEL functions"><link rel="prev" href="ch11.html" title="Chapter 11. List of GEL functions"><link rel="next" href="ch11s03.html" title="Parâmetros"></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">Básico</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch11.html">Prev</a> </td><th width="60%" align="center">Chapter 11. List of GEL functions</th><td width="20%" align="right"> <a accesskey="n" href="ch11s03.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="genius-gel-function-list-basic"></a>Básico</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span lang="en" class="term"><a name="gel-function-AskButtons"></a>AskButtons</span></dt><dd><pre lang="en" class="synopsis">AskButtons (query)</pre><pre lang="en" class="synopsis">AskButtons (query, button1, ...)</pre><p lang="en">Asks a question and presents a list of buttons to the user (or |
| 2 |
a menu of options in text mode). Returns the 1-based index of the button |
| 3 |
pressed. That is, returns 1 if the first button was pressed, 2 if the second |
| 4 |
button was pressed, and so on. If the user closes the window (or simply hits |
| 5 |
enter in text mode), then <code class="constant">null</code> is returned. The execution |
| 6 |
of the program is blocked until the user responds.</p><p lang="en">Version 1.0.10 onwards.</p></dd><dt><span lang="en" class="term"><a name="gel-function-AskString"></a>AskString</span></dt><dd><pre lang="en" class="synopsis">AskString (query)</pre><pre lang="en" class="synopsis">AskString (query, default)</pre><p lang="en">Asks a question and lets the user enter a string, which |
| 7 |
it then returns. If the user cancels or closes the window, then |
| 8 |
<code class="constant">null</code> is returned. The execution of the program |
| 9 |
is blocked until the user responds. If <code class="varname">default</code> is given, then it is pre-typed in for the user to just press enter on (version 1.0.6 onwards).</p></dd><dt><span lang="en" class="term"><a name="gel-function-Compose"></a>Compose</span></dt><dd><pre lang="en" class="synopsis">Compose (f,g)</pre><p lang="en">Compose two functions and return a function that is the composition of <code class="function">f</code> and <code class="function">g</code>.</p></dd><dt><span lang="en" class="term"><a name="gel-function-ComposePower"></a>ComposePower</span></dt><dd><pre lang="en" class="synopsis">ComposePower (f,n,x)</pre><p lang="en">Compose and execute a function with itself <code class="varname">n</code> times, passing <code class="varname">x</code> as argument. Returning <code class="varname">x</code> if |
| 10 |
<code class="varname">n</code> equals 0. |
| 11 |
Example: |
| 12 |
</p><pre lang="en" class="screen"><code class="prompt">genius></code> <strong class="userinput"><code>function f(x) = x^2 ;</code></strong> |
| 13 |
<code class="prompt">genius></code> <strong class="userinput"><code>ComposePower (f,3,7)</code></strong> |
| 14 |
= 5764801 |
| 15 |
<code class="prompt">genius></code> <strong class="userinput"><code>f(f(f(7)))</code></strong> |
| 16 |
= 5764801 |
| 17 |
</pre><p lang="en"> |
| 18 |
</p></dd><dt><span lang="en" class="term"><a name="gel-function-Evaluate"></a>Evaluate</span></dt><dd><pre lang="en" class="synopsis">Evaluate (str)</pre><p lang="en">Parses and evaluates a string.</p></dd><dt><span lang="en" class="term"><a name="gel-function-GetCurrentModulo"></a>GetCurrentModulo</span></dt><dd><pre lang="en" class="synopsis">GetCurrentModulo</pre><p lang="en">Get current modulo from the context outside the function. That is, if outside of |
| 19 |
the function was executed in modulo (using <code class="literal">mod</code>) then this returns what |
| 20 |
this modulo was. Normally the body of the function called is not executed in modular arithmetic, |
| 21 |
and this builtin function makes it possible to make GEL functions aware of modular arithmetic.</p></dd><dt><span lang="en" class="term"><a name="gel-function-Identity"></a>Identity</span></dt><dd><pre lang="en" class="synopsis">Identity (x)</pre><p lang="en">Identity function, returns its argument. It is equivalent to <strong class="userinput"><code>function Identity(x)=x</code></strong>.</p></dd><dt><span lang="en" class="term"><a name="gel-function-IntegerFromBoolean"></a>IntegerFromBoolean</span></dt><dd><pre lang="en" class="synopsis">IntegerFromBoolean (bval)</pre><p lang="en"> |
| 22 |
Make integer (0 for <code class="constant">false</code> or 1 for |
| 23 |
<code class="constant">true</code>) from a boolean value. |
| 24 |
<code class="varname">bval</code> can also be a number in which case a |
| 25 |
non-zero value will be interpreted as <code class="constant">true</code> and |
| 26 |
zero will be interpreted as <code class="constant">false</code>. |
| 27 |
</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsBoolean"></a>IsBoolean</span></dt><dd><pre lang="en" class="synopsis">IsBoolean (arg)</pre><p lang="en">Check if argument is a boolean (and not a number).</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsDefined"></a>IsDefined</span></dt><dd><pre lang="en" class="synopsis">IsDefined (id)</pre><p lang="en">Check if an id is defined. You should pass a string or |
| 28 |
and identifier. If you pass a matrix, each entry will be |
| 29 |
evaluated separately and the matrix should contain strings |
| 30 |
or identifiers.</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsFunction"></a>IsFunction</span></dt><dd><pre lang="en" class="synopsis">IsFunction (arg)</pre><p lang="en">Check if argument is a function.</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsFunctionOrIdentifier"></a>IsFunctionOrIdentifier</span></dt><dd><pre lang="en" class="synopsis">IsFunctionOrIdentifier (arg)</pre><p lang="en">Check if argument is a function or an identifier.</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsFunctionRef"></a>IsFunctionRef</span></dt><dd><pre lang="en" class="synopsis">IsFunctionRef (arg)</pre><p lang="en">Check if argument is a function reference. This includes variable |
| 31 |
references.</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsMatrix"></a>IsMatrix</span></dt><dd><pre lang="en" class="synopsis">IsMatrix (arg)</pre><p lang="en">Check if argument is a matrix. Even though <code class="constant">null</code> is |
| 32 |
sometimes considered an empty matrix, the function <code class="function">IsMatrix</code> does |
| 33 |
not consider <code class="constant">null</code> a matrix.</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsNull"></a>IsNull</span></dt><dd><pre lang="en" class="synopsis">IsNull (arg)</pre><p lang="en">Check if argument is a <code class="constant">null</code>.</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsString"></a>IsString</span></dt><dd><pre lang="en" class="synopsis">IsString (arg)</pre><p lang="en">Check if argument is a text string.</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsValue"></a>IsValue</span></dt><dd><pre lang="en" class="synopsis">IsValue (arg)</pre><p lang="en">Check if argument is a number.</p></dd><dt><span lang="en" class="term"><a name="gel-function-Parse"></a>Parse</span></dt><dd><pre lang="en" class="synopsis">Parse (str)</pre><p lang="en">Parses but does not evaluate a string. Note that certain |
| 34 |
pre-computation is done during the parsing stage.</p></dd><dt><span lang="en" class="term"><a name="gel-function-SetFunctionFlags"></a>SetFunctionFlags</span></dt><dd><pre lang="en" class="synopsis">SetFunctionFlags (id,flags...)</pre><p lang="en">Set flags for a function, currently <code class="literal">"PropagateMod"</code> and <code class="literal">"NoModuloArguments"</code>. |
| 35 |
If <code class="literal">"PropagateMod"</code> is set, then the body of the function is evaluated in modular arithmetic when the function |
| 36 |
is called inside a block that was evaluated using modular arithmetic (using <code class="literal">mod</code>). If |
| 37 |
<code class="literal">"NoModuloArguments"</code>, then the arguments of the function are never evaluated using modular arithmetic. |
| 38 |
</p></dd><dt><span lang="en" class="term"><a name="gel-function-SetHelp"></a>SetHelp</span></dt><dd><pre lang="en" class="synopsis">SetHelp (id,category,desc)</pre><p lang="en">Set the category and help description line for a function.</p></dd><dt><span lang="en" class="term"><a name="gel-function-SetHelpAlias"></a>SetHelpAlias</span></dt><dd><pre lang="en" class="synopsis">SetHelpAlias (id,alias)</pre><p lang="en">Sets up a help alias.</p></dd><dt><span lang="en" class="term"><a name="gel-function-chdir"></a>chdir</span></dt><dd><pre lang="en" class="synopsis">chdir (dir)</pre><p lang="en">Changes current directory, same as the <span class="command"><strong>cd</strong></span>.</p></dd><dt><span lang="en" class="term"><a name="gel-function-CurrentTime"></a>CurrentTime</span></dt><dd><pre lang="en" class="synopsis">CurrentTime</pre><p lang="en">Returns the current UNIX time with microsecond precision as a floating point number. That is, returns the number of seconds since January 1st 1970.</p><p lang="en">Version 1.0.15 onwards.</p></dd><dt><span lang="en" class="term"><a name="gel-function-display"></a>display</span></dt><dd><pre lang="en" class="synopsis">display (str,expr)</pre><p lang="en">Display a string and an expression with a colon to separate them.</p></dd><dt><span lang="en" class="term"><a name="gel-function-DisplayVariables"></a>DisplayVariables</span></dt><dd><pre lang="en" class="synopsis">DisplayVariables (var1,var2,...)</pre><p lang="en">Display set of variables. The variables can be given as |
| 39 |
strings or identifiers. For example: |
| 40 |
</p><pre lang="en" class="programlisting">DisplayVariables(`x,`y,`z) |
| 41 |
</pre><p lang="en"> |
| 42 |
</p><p lang="en"> |
| 43 |
If called without arguments (must supply empty argument list) as |
| 44 |
</p><pre lang="en" class="programlisting">DisplayVariables() |
| 45 |
</pre><p lang="en"> |
| 46 |
then all variables are printed including a stacktrace similar to |
| 47 |
<span class="guilabel">Show user variables</span> in the graphical version. |
| 48 |
</p><p lang="en">Version 1.0.18 onwards.</p></dd><dt><span lang="en" class="term"><a name="gel-function-error"></a>error</span></dt><dd><pre lang="en" class="synopsis">error (str)</pre><p lang="en">Prints a string to the error stream (onto the console).</p></dd><dt><span lang="en" class="term"><a name="gel-function-exit"></a>exit</span></dt><dd><pre lang="en" class="synopsis">exit</pre><p lang="en">Aliases: <code class="function">quit</code></p><p lang="en">Exits the program.</p></dd><dt><span lang="en" class="term"><a name="gel-function-false"></a>false</span></dt><dd><pre lang="en" class="synopsis">false</pre><p lang="en">Aliases: <code class="function">False</code> <code class="function">FALSE</code></p><p lang="en">The <code class="constant">false</code> boolean value.</p></dd><dt><span lang="en" class="term"><a name="gel-function-manual"></a>manual</span></dt><dd><pre lang="en" class="synopsis">manual</pre><p lang="en">Displays the user manual.</p></dd><dt><span lang="en" class="term"><a name="gel-function-print"></a>print</span></dt><dd><pre lang="en" class="synopsis">print (str)</pre><p lang="en">Prints an expression and then print a newline. The argument <code class="varname">str</code> can be any expression. It is |
| 49 |
made into a string before being printed.</p></dd><dt><span lang="en" class="term"><a name="gel-function-printn"></a>printn</span></dt><dd><pre lang="en" class="synopsis">printn (str)</pre><p lang="en">Prints an expression without a trailing newline. The argument <code class="varname">str</code> can be any expression. It is |
| 50 |
made into a string before being printed.</p></dd><dt><span lang="en" class="term"><a name="gel-function-PrintTable"></a>PrintTable</span></dt><dd><pre lang="en" class="synopsis">PrintTable (f,v)</pre><p lang="en">Print a table of values for a function. The values are in the |
| 51 |
vector <code class="varname">v</code>. You can use the vector |
| 52 |
building notation as follows: |
| 53 |
</p><pre lang="en" class="programlisting">PrintTable (f,[0:10]) |
| 54 |
</pre><p lang="en"> |
| 55 |
If <code class="varname">v</code> is a positive integer, then the table of |
| 56 |
integers from 1 up to and including v will be used. |
| 57 |
</p><p lang="en">Version 1.0.18 onwards.</p></dd><dt><span lang="en" class="term"><a name="gel-function-protect"></a>protect</span></dt><dd><pre lang="en" class="synopsis">protect (id)</pre><p lang="en">Protect a variable from being modified. This is used on the internal GEL functions to |
| 58 |
avoid them being accidentally overridden.</p></dd><dt><span lang="en" class="term"><a name="gel-function-ProtectAll"></a>ProtectAll</span></dt><dd><pre lang="en" class="synopsis">ProtectAll ()</pre><p lang="en">Protect all currently defined variables, parameters and |
| 59 |
functions from being modified. This is used on the internal GEL functions to |
| 60 |
avoid them being accidentally overridden. Normally <span class="application">Genius Mathematics Tool</span> considers |
| 61 |
unprotected variables as user defined.</p><p lang="en">Version 1.0.7 onwards.</p></dd><dt><span lang="en" class="term"><a name="gel-function-set"></a>set</span></dt><dd><pre lang="en" class="synopsis">set (id,val)</pre><p lang="en">Set a global variable. The <code class="varname">id</code> |
| 62 |
can be either a string or a quoted identifier. |
| 63 |
For example: |
| 64 |
</p><pre lang="en" class="programlisting">set(`x,1) |
| 65 |
</pre><p lang="en"> |
| 66 |
will set the global variable <code class="varname">x</code> to the value 1. |
| 67 |
</p><p lang="en">The function returns the <code class="varname">val</code>, to be |
| 68 |
usable in chaining.</p></dd><dt><span lang="en" class="term"><a name="gel-function-SetElement"></a>SetElement</span></dt><dd><pre lang="en" class="synopsis">SetElement (id,row,col,val)</pre><p lang="en">Set an element of a global variable which is a matrix. |
| 69 |
The <code class="varname">id</code> |
| 70 |
can be either a string or a quoted identifier. |
| 71 |
For example: |
| 72 |
</p><pre lang="en" class="programlisting">SetElement(`x,2,3,1) |
| 73 |
</pre><p lang="en"> |
| 74 |
will set the second row third column element of the global variable <code class="varname">x</code> to the value 1. If no global variable of the name exists, or if it is set to something that's not a matrix, a new zero matrix of appropriate size will be created. |
| 75 |
</p><p lang="en">The <code class="varname">row</code> and <code class="varname">col</code> can also be ranges, and the semantics are the same as for regular setting of the elements with an equals sign. |
| 76 |
</p><p lang="en">The function returns the <code class="varname">val</code>, to be |
| 77 |
usable in chaining.</p><p lang="en">Available from 1.0.18 onwards.</p></dd><dt><span lang="en" class="term"><a name="gel-function-SetVElement"></a>SetVElement</span></dt><dd><pre lang="en" class="synopsis">SetElement (id,elt,val)</pre><p lang="en">Set an element of a global variable which is a vector. |
| 78 |
The <code class="varname">id</code> |
| 79 |
can be either a string or a quoted identifier. |
| 80 |
For example: |
| 81 |
</p><pre lang="en" class="programlisting">SetElement(`x,2,1) |
| 82 |
</pre><p lang="en"> |
| 83 |
will set the second element of the global vector variable <code class="varname">x</code> to the value 1. If no global variable of the name exists, or if it is set to something that's not a vector (matrix), a new zero row vector of appropriate size will be created. |
| 84 |
</p><p lang="en">The <code class="varname">elt</code> can also be a range, and the semantics are the same as for regular setting of the elements with an equals sign. |
| 85 |
</p><p lang="en">The function returns the <code class="varname">val</code>, to be |
| 86 |
usable in chaining.</p><p lang="en">Available from 1.0.18 onwards.</p></dd><dt><span lang="en" class="term"><a name="gel-function-string"></a>string</span></dt><dd><pre lang="en" class="synopsis">string (s)</pre><p lang="en">Make a string. This will make a string out of any argument.</p></dd><dt><span lang="en" class="term"><a name="gel-function-true"></a>true</span></dt><dd><pre lang="en" class="synopsis">true</pre><p lang="en">Aliases: <code class="function">True</code> <code class="function">TRUE</code></p><p lang="en">The <code class="constant">true</code> boolean value.</p></dd><dt><span lang="en" class="term"><a name="gel-function-undefine"></a>undefine</span></dt><dd><pre lang="en" class="synopsis">undefine (id)</pre><p lang="en">Alias: <code class="function">Undefine</code></p><p lang="en">Undefine a variable. This includes locals and globals, |
| 87 |
every value on all context levels is wiped. This function |
| 88 |
should really not be used on local variables. A vector of |
| 89 |
identifiers can also be passed to undefine several variables. |
| 90 |
</p></dd><dt><span lang="en" class="term"><a name="gel-function-UndefineAll"></a>UndefineAll</span></dt><dd><pre lang="en" class="synopsis">UndefineAll ()</pre><p lang="en">Undefine all unprotected global variables |
| 91 |
(including functions and parameters). Normally <span class="application">Genius Mathematics Tool</span> |
| 92 |
considers protected variables as system defined functions |
| 93 |
and variables. Note that <code class="function">UndefineAll</code> |
| 94 |
only removes the global definition of symbols not local ones, |
| 95 |
so that it may be run from inside other functions safely. |
| 96 |
</p><p lang="en">Version 1.0.7 onwards.</p></dd><dt><span lang="en" class="term"><a name="gel-function-unprotect"></a>unprotect</span></dt><dd><pre lang="en" class="synopsis">unprotect (id)</pre><p lang="en">Unprotect a variable from being modified.</p></dd><dt><span lang="en" class="term"><a name="gel-function-UserVariables"></a>UserVariables</span></dt><dd><pre lang="en" class="synopsis">UserVariables ()</pre><p lang="en">Return a vector of identifiers of |
| 97 |
user defined (unprotected) global variables.</p><p lang="en">Version 1.0.7 onwards.</p></dd><dt><span lang="en" class="term"><a name="gel-function-wait"></a>wait</span></dt><dd><pre lang="en" class="synopsis">wait (secs)</pre><p lang="en">Waits a specified number of seconds. <code class="varname">secs</code> |
| 98 |
must be non-negative. Zero is accepted and nothing happens in this case, |
| 99 |
except possibly user interface events are processed.</p><p lang="en">Since version 1.0.18, <code class="varname">secs</code> can be a noninteger number, so |
| 100 |
<strong class="userinput"><code>wait(0.1)</code></strong> will wait for one tenth of a second.</p></dd><dt><span lang="en" class="term"><a name="gel-function-version"></a>version</span></dt><dd><pre lang="en" class="synopsis">version</pre><p lang="en">Returns the version of Genius as a horizontal 3-vector with |
| 101 |
major version first, then minor version and finally the patch level.</p></dd><dt><span lang="en" class="term"><a name="gel-function-warranty"></a>warranty</span></dt><dd><pre lang="en" class="synopsis">warranty</pre><p lang="en">Gives the warranty information.</p></dd></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch11.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch11.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch11s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 11. List of GEL functions </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Parâmetros</td></tr></table></div></body></html> |