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.


\function{ _function_name_ }{ _expression_ }



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:


  • a fixed number from a field defined by \field
  • a variable name including variables (or functions) defined elsewhere in the variables section.
  • 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_base()$$ base must be integer or Euler number $$e$$, $$log()$$, $$exp()$$ ,
      with usual meaning
    • also $$abs()$$ for absolute value, $$fac()$$ for integer factorial function, $$floor()$$ math floor, $$re(), im()$$ and $$conj()$$ for complex real and imaginary part and complex conjugate,
    • finally, $$sign()$$ and $$theta()$$ to denote the signum and Heaviside functions.
  • 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)


  • 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; thus, for two integral numbers $$a$$ and $$b$$, a mod b is the remainder of the division of a by b
  • 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$$,
    so the expression in function{ _function_name_ }{ _expression_ } should use at most one more variable than defined in the
    corresponding variables section, namely the independent variable of the function @-placeholder-@, denoting an
    element of the function domain. You may call it x or y or whatever, but this variable name must not occur in the variables section.

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.


\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 (non-declared) 'true' variable (@-placeholder-@)


  • 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.


\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


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

\randadjustIf{a,b}{a=b OR b=0}