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}

Capture

More Examples

Multiple of π as interval boundaries

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}