An expression contains real numbers, variable names, function calls, and the following operators:
In addition, variables and functions can be defined by the user. A variable definition has the form:
var = expression ;
Any instance of the variable in an expression will be replaced with its definition. A function definition has the form:
func(a1, a2, ..) = expression ;
The expression can contain instances of the function arguments as well as other variables and functions. Function names can be passed as arguments. Recursive functions can be defined using calls to the defined function or other functions calling the defined function.
To define a constant expression, simply replace the equals sign ('=') with a colon (':') in a definition. Constant expressions are evaluated only once, the first time they are used. This avoids repeated evaluation of expressions whose values never change. Ideally, a constant expression contains only numbers and references to previously defined constant expressions and functions. Constant function definitions are are replaced by their value in any expression that uses them with constant arguments. All predefined functions and variables have the constant attribute. Thus, "sin(PI/4)" in an expression would be immediately replaced by ".707108" unless sin() or PI were redefined by the user. (Note that redefining constant expressions is not a recommended practice!)
A variable or function's definition can be displayed with the `?' command:
If no name is given, all definitions are printed. The `>' command writes definitions to a file:
Similarly, the `<' command loads definitions.
The following library of predefined functions and variables is provided:
select(N, a1, a2, ..)
return aN (N is rounded to the nearest integer). This function provides array capabilities. If N is zero, the number of available arguments is returned.
sin(x), cos(x), tan(x)
asin(x), acos(x), atan(x)
inverse trigonometric functions.
inverse tangent of y/x (range -pi to pi).
Table of Contents