AskButtons (вопрос)
AskButtons (вопрос, кнопка1, ...)
Задаёт вопрос и предлагает пользователю список кнопок (или меню вариантов в текстовом режиме). Возвращает отсчитываемый с 1 индекс нажатой кнопки. То есть 1, если нажата первая кнопка, 2 — если нажата вторая и т.д. Если пользователь закрыл окно (или просто нажал Enter в текстовом режиме), то возвращает null
. Выполнение программы останавливается, пока пользователь не ответит.
Version 1.0.10 onwards.
AskString (query)
AskString (query, default)
Asks a question and lets the user enter a string, which
it then returns. If the user cancels or closes the window, then
null
is returned. The execution of the program
is blocked until the user responds. If default
is given, then it is pre-typed in for the user to just press enter on (version 1.0.6 onwards).
Compose (f,g)
Compose two functions and return a function that is the composition of f
and g
.
ComposePower (f,n,x)
Compose and execute a function with itself n
times, passing x
as argument. Returning x
if
n
equals 0.
Example:
genius>
function f(x) = x^2 ;
genius>
ComposePower (f,3,7)
= 5764801genius>
f(f(f(7)))
= 5764801
Evaluate (str)
Parses and evaluates a string.
GetCurrentModulo
Get current modulo from the context outside the function. That is, if outside of
the function was executed in modulo (using mod
) 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.
Identity (x)
Identity function, returns its argument. It is equivalent to function Identity(x)=x
.
IntegerFromBoolean (bval)
Преобразует логическое значение в целое число (0 для false
или 1 для true
). bval
может также быть числом, в этом случае ненулевое значение интерпретируется как true
, а нулевое — как false
.
IsBoolean (arg)
Проверяет, является аргумент логическим значением (а не числом).
IsDefined (id)
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.
IsFunction (arg)
Проверяет, является ли аргумент функцией.
IsFunctionOrIdentifier (arg)
Check if argument is a function or an identifier.
IsFunctionRef (arg)
Check if argument is a function reference. This includes variable references.
IsMatrix (arg)
Проверяет, является ли аргумент матрицей. Хотя null
иногда используют вместо пустой матрицы, функция IsMatrix
не считает null
матрицей.
IsNull (arg)
Проверяет, имеет ли аргумент значение null
.
IsString (arg)
Проверяет, является ли аргумент текстовой строкой.
IsValue (arg)
Проверяет, является ли аргумент числом.
Parse (str)
Parses but does not evaluate a string. Note that certain pre-computation is done during the parsing stage.
SetFunctionFlags (id,flags...)
Set flags for a function, currently "PropagateMod"
and "NoModuloArguments"
.
If "PropagateMod"
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 mod
). If
"NoModuloArguments"
, then the arguments of the function are never evaluated using modular arithmetic.
SetHelp (id,category,desc)
Set the category and help description line for a function.
SetHelpAlias (id,alias)
Sets up a help alias.
chdir (dir)
Изменяет текущий каталог. То же, что и cd.
CurrentTime
Возвращает текущее время UNIX с точностью до микросекунд в виде числа с плавающей точкой. То есть возвращает число секунд с 1 января 1970 г.
Version 1.0.15 onwards.
display (str,expr)
Display a string and an expression with a colon to separate them.
DisplayVariables (var1,var2,...)
Display set of variables. The variables can be given as strings or identifiers. For example:
DisplayVariables(`x,`y,`z)
If called without arguments (must supply empty argument list) as
DisplayVariables()
then all variables are printed including a stacktrace similar to Show user variables in the graphical version.
Version 1.0.18 onwards.
error (str)
Выводит строку в поток ошибок (на консоль).
exit
Псевдоним: quit
Завершает работу программы.
false
Псевдонимы: False
FALSE
Логическое значение false
(ложь).
manual
Показывает руководство пользователя.
print (str)
Выводит выражение и выполняет переход на новую строку. Аргумент str
может быть любым выражением. Он преобразуется в строку перед выводом.
printn (str)
Выводит выражение без перехода на новую строку. Аргумент str
может быть любым выражением. Он преобразуется в строку перед выводом.
PrintTable (f,v)
Print a table of values for a function. The values are in the
vector v
. You can use the vector
building notation as follows:
PrintTable (f,[0:10])
If v
is a positive integer, then the table of
integers from 1 up to and including v will be used.
Version 1.0.18 onwards.
protect (id)
Protect a variable from being modified. This is used on the internal GEL functions to avoid them being accidentally overridden.
ProtectAll ()
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 Genius Mathematics Tool considers unprotected variables as user defined.
Version 1.0.7 onwards.
set (id,val)
Set a global variable. The id
can be either a string or a quoted identifier.
For example:
set(`x,1)
will set the global variable x
to the value 1.
The function returns the val
, to be
usable in chaining.
SetElement (id,row,col,val)
Set an element of a global variable which is a matrix.
The id
can be either a string or a quoted identifier.
For example:
SetElement(`x,2,3,1)
will set the second row third column element of the global variable x
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.
The row
and col
can also be ranges, and the semantics are the same as for regular setting of the elements with an equals sign.
The function returns the val
, to be
usable in chaining.
Available from 1.0.18 onwards.
SetElement (id,elt,val)
Set an element of a global variable which is a vector.
The id
can be either a string or a quoted identifier.
For example:
SetElement(`x,2,1)
will set the second element of the global vector variable x
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.
The elt
can also be a range, and the semantics are the same as for regular setting of the elements with an equals sign.
The function returns the val
, to be
usable in chaining.
Available from 1.0.18 onwards.
string (s)
Преобразует аргумент любого типа в строку.
true
Псевдонимы: True
TRUE
Логическое значение true
(истина).
undefine (id)
Alias: Undefine
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.
UndefineAll ()
Undefine all unprotected global variables
(including functions and parameters). Normally Genius Mathematics Tool
considers protected variables as system defined functions
and variables. Note that UndefineAll
only removes the global definition of symbols not local ones,
so that it may be run from inside other functions safely.
Version 1.0.7 onwards.
unprotect (id)
Unprotect a variable from being modified.
UserVariables ()
Возвращает вектор идентификаторов определённых пользователем (незащищённых) глобальных переменных.
Version 1.0.7 onwards.
wait (secs)
Waits a specified number of seconds. secs
must be non-negative. Zero is accepted and nothing happens in this case,
except possibly user interface events are processed.
Since version 1.0.18, secs
can be a noninteger number, so
wait(0.1)
will wait for one tenth of a second.
version
Returns the version of Genius as a horizontal 3-vector with major version first, then minor version and finally the patch level.
warranty
Gives the warranty information.