File: ch11s02.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 (85 lines) | stat: -rw-r--r-- 21,089 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Основные</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><link rel="home" href="index.html" title="Руководство пользователя Genius"><link rel="up" href="ch11.html" title="Chapter 11. Список функций GEL"><link rel="prev" href="ch11.html" title="Chapter 11. Список функций GEL"><link rel="next" href="ch11s03.html" title="Параметры"></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">Основные</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch11.html">Prev</a> </td><th width="60%" align="center">Chapter 11. Список функций GEL</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>Основные</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 class="synopsis">AskButtons (вопрос)</pre><pre class="synopsis">AskButtons (вопрос, кнопка1, ...)</pre><p>Задаёт вопрос и предлагает пользователю список кнопок (или меню вариантов в текстовом режиме). Возвращает отсчитываемый с 1 индекс нажатой кнопки. То есть 1, если нажата первая кнопка, 2 — если нажата вторая и т.д. Если пользователь закрыл окно (или просто нажал Enter в текстовом режиме), то возвращает <code class="constant">null</code>. Выполнение программы останавливается, пока пользователь не ответит.</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
it then returns.  If the user cancels or closes the window, then
<code class="constant">null</code> is returned.  The execution of the program
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
<code class="varname">n</code> equals 0.
		Example:
          </p><pre lang="en" class="screen"><code class="prompt">genius&gt;</code> <strong class="userinput"><code>function f(x) = x^2 ;</code></strong>
<code class="prompt">genius&gt;</code> <strong class="userinput"><code>ComposePower (f,3,7)</code></strong>
= 5764801
<code class="prompt">genius&gt;</code> <strong class="userinput"><code>f(f(f(7)))</code></strong>
= 5764801
</pre><p lang="en">
	  </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
the function was executed in modulo (using <code class="literal">mod</code>) then this returns what
this modulo was.  Normally the body of the function called is not executed in modular arithmetic,
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 class="synopsis">IntegerFromBoolean (bval)</pre><p>Преобразует логическое значение в целое число (0 для <code class="constant">false</code> или 1 для <code class="constant">true</code>). <code class="varname">bval</code> может также быть числом, в этом случае ненулевое значение интерпретируется как <code class="constant">true</code>, а нулевое — как <code class="constant">false</code>.</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsBoolean"></a>IsBoolean</span></dt><dd><pre class="synopsis">IsBoolean (arg)</pre><p>Проверяет, является аргумент логическим значением (а не числом).</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
	   and identifier.  If you pass a matrix, each entry will be
	   evaluated separately and the matrix should contain strings
	   or identifiers.</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsFunction"></a>IsFunction</span></dt><dd><pre class="synopsis">IsFunction (arg)</pre><p>Проверяет, является ли аргумент функцией.</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
references.</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsMatrix"></a>IsMatrix</span></dt><dd><pre class="synopsis">IsMatrix (arg)</pre><p>Проверяет, является ли аргумент матрицей. Хотя <code class="constant">null</code> иногда используют вместо пустой матрицы, функция <code class="function">IsMatrix</code> не считает <code class="constant">null</code> матрицей.</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsNull"></a>IsNull</span></dt><dd><pre class="synopsis">IsNull (arg)</pre><p>Проверяет, имеет ли аргумент значение <code class="constant">null</code>.</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsString"></a>IsString</span></dt><dd><pre class="synopsis">IsString (arg)</pre><p>Проверяет, является ли аргумент текстовой строкой.</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsValue"></a>IsValue</span></dt><dd><pre class="synopsis">IsValue (arg)</pre><p>Проверяет, является ли аргумент числом.</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
	    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>.
If <code class="literal">"PropagateMod"</code> is set, then the body of the function is evaluated in modular arithmetic when the function
is called inside a block that was evaluated using modular arithmetic (using <code class="literal">mod</code>).  If
<code class="literal">"NoModuloArguments"</code>, then the arguments of the function are never evaluated using modular arithmetic.
 </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 class="synopsis">chdir (dir)</pre><p>Изменяет текущий каталог. То же, что и <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 class="synopsis">CurrentTime</pre><p>Возвращает текущее время UNIX с точностью до микросекунд в виде числа с плавающей точкой. То есть возвращает число секунд с 1 января 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
		  strings or identifiers.  For example:
	    </p><pre lang="en" class="programlisting">DisplayVariables(`x,`y,`z)
	    </pre><p lang="en">
	  </p><p lang="en">
		  If called without arguments (must supply empty argument list) as
	    </p><pre lang="en" class="programlisting">DisplayVariables()
	    </pre><p lang="en">
	    then all variables are printed including a stacktrace similar to
	    <span class="guilabel">Show user variables</span> in the graphical version.
	  </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 class="synopsis">error (str)</pre><p>Выводит строку в поток ошибок (на консоль).</p></dd><dt><span lang="en" class="term"><a name="gel-function-exit"></a>exit</span></dt><dd><pre class="synopsis">exit</pre><p>Псевдоним: <code class="function">quit</code></p><p>Завершает работу программы.</p></dd><dt><span lang="en" class="term"><a name="gel-function-false"></a>false</span></dt><dd><pre class="synopsis">false</pre><p lang="en">Aliases: <code class="function">False</code> <code class="function">FALSE</code></p><p>Логическое значение <code class="constant">false</code> (ложь).</p></dd><dt><span lang="en" class="term"><a name="gel-function-manual"></a>manual</span></dt><dd><pre class="synopsis">manual</pre><p>Показывает руководство пользователя.</p></dd><dt><span lang="en" class="term"><a name="gel-function-print"></a>print</span></dt><dd><pre class="synopsis">print (str)</pre><p>Выводит выражение и выполняет переход на новую строку. Аргумент <code class="varname">str</code> может быть любым выражением. Он преобразуется в строку перед выводом.</p></dd><dt><span lang="en" class="term"><a name="gel-function-printn"></a>printn</span></dt><dd><pre class="synopsis">printn (str)</pre><p>Выводит выражение без перехода на новую строку. Аргумент <code class="varname">str</code> может быть любым выражением. Он преобразуется в строку перед выводом.</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 
		  vector <code class="varname">v</code>.  You can use the vector
		  building notation as follows:
      		  </p><pre lang="en" class="programlisting">PrintTable (f,[0:10])
	    </pre><p lang="en">
	    If <code class="varname">v</code> is a positive integer, then the table of
	    integers from 1 up to and including v will be used.
	  </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
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
functions from being modified.  This is used on the internal GEL functions to
avoid them being accidentally overridden.  Normally <span class="application">Genius Mathematics Tool</span> considers
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>
            can be either a string or a quoted identifier.
	    For example:
	    </p><pre lang="en" class="programlisting">set(`x,1)
	    </pre><p lang="en">
	    will set the global variable <code class="varname">x</code> to the value 1.
	  </p><p lang="en">The function returns the <code class="varname">val</code>, to be
	  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.
		  The <code class="varname">id</code>
            can be either a string or a quoted identifier.
	    For example:
	    </p><pre lang="en" class="programlisting">SetElement(`x,2,3,1)
	    </pre><p lang="en">
	    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.
	  </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.
	  </p><p lang="en">The function returns the <code class="varname">val</code>, to be
	  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.
		  The <code class="varname">id</code>
            can be either a string or a quoted identifier.
	    For example:
	    </p><pre lang="en" class="programlisting">SetElement(`x,2,1)
	    </pre><p lang="en">
	    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.
	  </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.
	  </p><p lang="en">The function returns the <code class="varname">val</code>, to be
	  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 class="synopsis">string (s)</pre><p>Преобразует аргумент любого типа в строку.</p></dd><dt><span lang="en" class="term"><a name="gel-function-true"></a>true</span></dt><dd><pre class="synopsis">true</pre><p lang="en">Aliases: <code class="function">True</code> <code class="function">TRUE</code></p><p>Логическое значение <code class="constant">true</code> (истина).</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,
	    every value on all context levels is wiped.  This function
	    should really not be used on local variables.  A vector of
	    identifiers can also be passed to undefine several variables.
          </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
	    (including functions and parameters).  Normally <span class="application">Genius Mathematics Tool</span>
	    considers protected variables as system defined functions
	    and variables.  Note that <code class="function">UndefineAll</code>
	    only removes the global definition of symbols not local ones,
	    so that it may be run from inside other functions safely.
	  </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 class="synopsis">UserVariables ()</pre><p>Возвращает вектор идентификаторов определённых пользователем (незащищённых) глобальных переменных.</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>
must be non-negative.  Zero is accepted and nothing happens in this case,
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
		  <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
	  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. Список функций GEL </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Параметры</td></tr></table></div></body></html>