Expressions And Relations
Expressions usable in \function
In a MUMIE TeX problem document you may use the \function
command within a variables section to define a variable of type function.
Syntax:
\function{ function_name }{ expression }
Example:
1 2 3 4  \begin{variables}
\number{a}{2}
\function{f}{a*x^2+2}
\end{variables}

This introduces first a number variable $$a$$ with value $$2$$, and then a function variable $$f$$ with value $$2x²+2$$, considering that a is assigned the value $$2$$.
More generally: An expression in a MUMIE problem is by definition:
Definition
 a fixed number from a field defined by
\field
 a variable name including variables (or functions) defined elsewhere in the variables section.
Expressions usable in the definition of functions
 if
expr
is an expression, then so is (expr)
 if
expr
is an expression, then so is  expr
 if
expr1
and expr2
are expressions, then expr1 + expr2
is an expression
 same for

*
/
^
mod
 if
expr
is an expression, then so is sqrt(expr)
, denoting the square root
 other admissible function names are:
cbrt()
cubic root
sin()
cos()
tan()
cot()
sinh()
cosh()
tanh()
coth()
arcsin()
arccos()
arctan()
arccot()
arsinh()
arcosh()
artanh()
arcoth()
ln()
log()
exp()
log_{base}()
(note: base must be integer or Euler number)
 also
abs()
for absolute value, fac()
for integer factorial function, floor()
math floor, re()
im()
conj()
for complex real and imaginary part and complex conjugate,
sign()
dirac()
theta()
denote the signum, Dirac delta and heaviside functions. Note: If the number field is complex or complexrational, those functions are only defined if the imaginary part of the argument is zero.
 finally,
min()
max()
compute the minimum or the maximum of an as input given matrix / row vector, either defined as a matrix / row vector identifier or directly (using the python like syntax ). E.g. min(myMatrix)
where myMatrix is a matrix identifier, min([1;3;2;5])
. Those two functions are not defined for nonreal numbers.
 if
expr
is an expression, then so is expr
as an alternative for abs(expr)
 if
expr
is an expression and n is a positive integer, than expr_#n
is an alternative way to write expr^(1/n)
Remarks:
 observe the usual precedence rules: so
expr1 * expr2
is in general not the product of both expressions as seen by the example a+b*c+d
mod
denotes the modulo operator; e.g. $$4$$ $$mod$$ $$3 = 1$$, $$3.5$$ $$mod$$ $$1.5 = 0.5$$, $$3.5$$ $$mod$$ $$1.5 = 0.5$$
 standard functions have to be written with their parentheses, so sin x is not permitted
 do not denote variables by standard function names
 observe that in the generic TeX framework discussed here all functions defined by the
\function
command are expected to define functions on $$R, N, Q$$ or, possibly, $$C$$
 in the expression in
\function{ function name }{ expression }
one or more independent variables (free parameters) can be used, e.g. 2*x
, x+y
,(x_1)^2
. Make sure that the names of the independent variables are not used as function names anywhere in the variables environment
Expressions usable in \checkFuncForZero
The \checkFuncForZero
command is used to check a functional of user defined functions for being zero numerically.
User defined functions are e.g. defined by the student's inputs via the command \inputAsFunction
. The corresponding inputs can be
checked by the corrector program using the criterion delivered by \checkFuncForZero
.
Syntax:
\checkFuncForZero{ functionial_expression }{ lower_check_bound }{ upper_check_bound }{ number_checkpoints }
A functional_expression is in principle an expression in the occuring functions which may be subject to the usual arithmetic
operations and additionally composition and derivation operations.
So the definition of an expression as above is extended by the following:
 any expression as defined above is a functional expression, too
 a function name declared by an
\inputAsFunction
command in the same question block is a functional expression
 If expr is a functional expression and $$f$$ is a function name either declared by a
\function
command or by an \inputAsFunction
command in the same question block, then f[ expression ] is a functional expression
you must use square brackets in case of these function names, while you have to use round brackets in case of standard functions like $$sqrt$$ or $$sin$$
 If expr is a functional expression, then D[ expression ] is a functional expression, denoting the derivative of
expression (so avoid $$D$$ as a functions or variables name)
This defines, what a syntactically correct functional expression is.
Hence in particular you may use
 fixed numbers as 3.1415
 valid number variables, declared by
\number
or \randint
 valid programmer defined functions declared by
\function
 valid user defined (input) functions declared by
\inputAsFunction
 explicitly defined functions (as x^2+3), but only x is allowed here as valid (nondeclared) 'true' variable (@placeholder@)
Examples:
f[g]
, if $$f$$ and $$g$$ are function names
sin(f)
, if f is a function name
f[sin(x)]
, if f is a function name
D[D[f]]
, if f is a function name
f[x^3+a*x+b]
, if f is a function's name and a is a declared number variable or function variable
Relations usable in \randadjustIf
The \randadjustIf
command is used to redefine number variables which had been declared by
\randint
in order to avoid certain unfavorable combinations of variables.
Syntax:
\randadjustIf{ list_of_variables }{ avoidance_relation }
We define, what a relation is:
 If expr1, expr2 are expressions, then expr1 = expr2 is a relation
 same for the other comparision operators $$!=$$ (means unequal), $$>$$, $$<$$, $$>=$$ , $$<=$$
 If rel is a relation, then [ rel ] is a relation (observe that square brackets are used to bundle relations)
 If rel1 , rel2 are relations, then rel1 AND rel2 is a relation, as well as rel1 OR rel2 and
NOT rel1 are relations
Observe the precedence rules: NOT precedes AND precedes OR.
Also, bear in mind, that we are talking about avoidance relations in the context of \randadjustIf
, so in the example
1 2 3  \randint{a}{2}{20}
\randint[Z]{b}{20}{20}
\randadjustIf{a,b}{a=b}

the result are random parameters a and b which are different. Remember that the [Z]flag instructs the compiler to
avoid zero for b. So this example yields the same result as
1 2 3  \randint{a}{2}{20}
\randint{b}{20}{20}
\randadjustIf{a,b}{a=b OR b=0}
