You're not reading the latest revision of this page, which is
here.
Interval
Consider the case that the answer to a problem is an interval or an union of disjoint intervals.
The optional TeX command \allowIntervalUnionsForInput[true]
enables the option that the student's answer can be given by the union of multiple intervals.
Solution syntax
The solution is defined by a left and a right boundary , both seperated by a semicolon.
boundary |
symbol |
open left |
( or ] |
closed left |
[ |
open right |
) or [ |
closed right |
] |
e.g. \solution{(-1;1]}
, \solution{]-1;1]}
(same interval as the first one), \solution{(myVar;100[}
The correct solution as an union of multiple disjoint intervals can be given by separating them with a comma. E.g. \solution{(-infinity;2],[3;infinity)}
Be aware that this is only possible if the optional command \allowIntervalUnionsForInput[true]
is used.
Examples
1 2 3 4 5 | \begin{answer}
\type{input.interval}
\text{Write down the interval from 1 to 3:}
\solution{[1;3]}
\end{answer}
|
1 2 3 4 5 6 | \begin{answer}
\type{input.interval}
\text{input.interval: $[1;4) = $}
\allowIntervalUnionsForInput
\solution{[1;4)}
\end{answer}
|
More Examples
Interval boundaries with multiple of π
If you want, that the solution and/or the answer boundaries can be written as multiple of π, use the command \allowForInput{pi}
.
Example
1 2 3 4 5 6 | \begin{answer}
\type{input.interval}
\text{input.interval: $[\pi;4\cdot\pi) = $}
\allowForInput{pi * / + - . ,}
\solution{[pi;4*pi)}
\end{answer}
|
Interval boundaries with variables
If you want, that the solution and/or the answer boundaries contain variables and not just numbers, use the command \checkAsFunction
.
It works the same way as it does for input type input.function:
\checkAsFunction[options]{<variable>}{<low>}{<high>}{<steps>}
will automatically be a valid input. The answer will be numerically compared with the solution based on the command's parameters.
Example
1 2 3 4 5 6 | \begin{answer}
\type{input.interval}
\text{input.interval: $[-k;2k) = $}
\checkAsFunction[0.001]{k}{-1}{1}{10}
\solution{[-k;2k)}
\end{answer}
|
In this example the answer will be compared numerically for 10 random values of k between -1 and 1. The difference beween answer and solution cannot be equal or bigger than 0.001.