number fields

Number fields

All variables and functions are interpreted in a number field which can be defined within the
question environment by the \field{...} command. It can take one of the following values:

number field Description
real real numbers (i.e. decimal numbers); this is the default value if the \field{number field} command is omitted
integer integer numbers
rational rational numbers
complex complex numbers with real numbers as real and imaginary parts
complex-rational complex numbers with rational numbers as real and imaginary parts
1
2
3
4
5
6
7
8
9
10
11
\begin{problem}
 
  \begin{question}
    \field{...} %  set for this question and all their answers
 
    \begin{answer}
        ...
    \end{answer}         
 
  \end{question}        
\end{problem}

Precision of real numbers

If the number field is chosen to be real or complex, there are two issues of precision:
the display-precision of the numbers/functions and the corrector-precision.

For more information about precision see also the two examples in WebMiau:
https://miau.mumie.net/web-miau/editor/content%2Fexamples%2FinputFunction%2Fprb_calculations_with_roundet_numbers.src.tex
https://miau.mumie.net/web-miau/editor/content%2Fexamples%2FinputFunction%2Fprb_input_function_rounding_numbers_correctorprecision.src.tex

Important conditions:

  • Corrector precision must be less or equal to displayprecision.
  • For all functions rounded to a precision $n$ the xorrector precision must be less or equal to n.

Display precision

For displaying variables defined by \number,\randdouble, or \randrat one uses the
command \displayprecision{\} which defines the number of digits
used for displaying.
If not specified, then the generic problem will use the default value of 2.

When a number was created by the \function-command (or \substitute or \derivative)
using the calculate option, the precision defined with the above command will be
ignored. This is because computations should not be rounded while not visible to the user.
In case you do want to display the calculated value then set the precision within the command,

\function[calculate,3]{f}{c/3}.

Again this value should be $$\geq$$ corrector precision.

Corrector precision

The precision used for correction depends on the type of the answer.

For type input.number, one uses the command
\correctorprecision[correctorOption]{number of decimal digits}
similar to \displayprecision. For details see the wiki-page about rounding

If \correctorprecision is not specified, then the generic problem will use the default
value of 2.

For answers of type input.function the precision is given as an optional argument in the
command that specifies how to check the given answer for correctness.
See Corrector commands for input.function.