... |
... |
@@ -2,41 +2,41 @@ |
2 |
2 |
|
3 |
3 |
# Create input field problems |
4 |
4 |
|
5 |
|
-* input field questions must have the question type |
|
5 |
+* input field questions must have one of the question types |
6 |
6 |
* input.number |
|
7 |
+ * input.finite-number-set |
7 |
8 |
* input.function |
|
9 |
+ * input.cases.function |
|
10 |
+ * input.interval |
8 |
11 |
* input.matrix |
9 |
12 |
* input.text |
10 |
|
- * input.interval |
11 |
|
-* instead of defining _choices_, this question type contains one or several _answers_. |
12 |
|
- |
13 |
|
-## Defining answers and precision of real numbers |
14 |
|
- |
15 |
|
-Every answer must be defined in an _answer_ environment and will be represented by a single input field for entering values. Answers **must** use the **\solution{<variable>}** command which will be compared to the users answer to determine its correctness. The comparison of the user answer will be done with a certain _precision_, this value can be specified in the question environment. |
16 |
|
- |
17 |
|
-The precision in the generic problem is divided into: |
18 |
|
-* **\displayprecision{<number of decimal digits>}** defines the number of digits used for displaying real numbers in the mathlet. *If not specified, then the generic problem will use the default value of 2.* |
19 |
|
-* **\correctorprecision[<correctorOption, default is atleast>]{<number of decimal digits>}** defines the precision used for the corrector to compare answer and solution. corrector precision should not be greater than display precision. If corrector precision is not defined, then the display precision will be used. |
20 |
|
- |
21 |
|
-### Corrector Option |
|
13 |
+ * input.truth-table |
22 |
14 |
|
23 |
|
-There are three options for comparing the real answer with the solution: |
|
15 |
+For the general structure of input field questions |
|
16 |
+see [Structure of Questions](structure-problems.md#question-environment). |
24 |
17 |
|
25 |
|
-1. **atleast** means that the answer must be typed in (rounded) with atleast the given precision. **This is the default option.** |
26 |
|
-2. **rounded** means that the answer must be rounded. <p class="info">If you use this option, make sure you tell the user that they must round the result with the given precision</p> |
27 |
|
-3. **truncate** means that the answer should not be rounded, and should just be typed in up to the defined number of decimal digits. |
|
18 |
+The answer blocks are of the form: |
|
19 |
+```LaTeX |
|
20 |
+\begin{answer} |
|
21 |
+ \type{...} % only if the question-type is input.generic |
|
22 |
+ \text{...} % Text that appears next to the input box. This command is ignored, |
|
23 |
+ % if in the question text the answer is referenced by \ansref. |
|
24 |
+ |
|
25 |
+ \solution{...} % Defines what a correct solution would be. The argument |
|
26 |
+ % has to be a variable name defined in the variables environment. |
|
27 |
+ |
|
28 |
+ ... % Some commands specifying how the student input should be |
|
29 |
+ % checked for correctness. |
|
30 |
+ \explanation{..} % optional explanation text that appears if the student answer was not correct. |
|
31 |
+ \score{..} % optional, provides the answer with a different score than 1. |
|
32 |
+\end{answer} |
|
33 |
+``` |
28 |
34 |
|
29 |
|
-## Type: Input Number |
30 |
35 |
|
31 |
|
-Optionally, one can use the following commands within the _answer_ environment: |
32 |
36 |
|
33 |
|
-* **\text{<description>}**: will add a label in front of the input field. It's probably best not to make this label too long. It would be better to put longer descriptions within the question task. |
34 |
|
-* **\explanation{<description>}**: this explanation will be visible in the corrector page. It will be shown below the explanation defined for the question and will have the label of the task in front of it. |
35 |
|
- * If **\showExplanation{always}** is used within the question, it will always show both the question and answer explanation, regardless of the correctness of the users answer. |
|
37 |
+# Type: Input Number |
36 |
38 |
|
37 |
|
-<div class="alert green"> |
38 |
|
-The argument of the <b><i>solution</i></b> must be a variable name defined in the variables environment. |
39 |
|
-</div> |
|
39 |
+For type input.number there are no additional corrector specifications in the answer environment. |
40 |
40 |
|
41 |
41 |
The following example shows a question with a number as input which has one single constant as an answer: |
42 |
42 |
|
... |
... |
@@ -44,9 +44,9 @@ The following example shows a question with a number as input which has one sing |
44 |
44 |
\begin{question} |
45 |
45 |
|
46 |
46 |
\begin{variables} |
47 |
|
- \function{f}{a/b} |
48 |
47 |
\number{a}{11} |
49 |
48 |
\number{b}{16} |
|
49 |
+ \function{f}{a/b} |
50 |
50 |
\end{variables} |
51 |
51 |
|
52 |
52 |
\type{input.number} |
... |
... |
@@ -66,36 +66,36 @@ The following example shows a question with a number as input which has one sing |
66 |
66 |
\end{question} |
67 |
67 |
``` |
68 |
68 |
|
69 |
|
-In the above example the following commands where used. |
70 |
|
-* **\text** an optional label that will be placed _in front_ of an answer (input) field |
71 |
|
-* **\solution** the solution that will be used to compare with the answer of the user. |
72 |
|
-* **\precision** determines, _a.)_ how many digits behind the decimal mark the corrector will be using to determine whether the user's answer was correct, and _b.)_ the amount of digits behind the decimal mark when displaying a number of type real. The default value for precision is set to 2. Both _a.)_ and _b.)_ can be overridden using `\correctorprecision` and `\displayprecision` respectively. |
73 |
|
- * **\correctorprecision** overrides the (default) value of `\precision` when comparing the correct solution with the user's answer. |
74 |
|
- * **\displayprecision** overrides the (default) value of `\precision` when displaying real numbers on the screen. Logically **displayprecision** $$\geq$$ **correctorprecision** |
75 |
|
- |
76 |
|
-```LaTeX |
77 |
|
- % Real numbers will be shown with 4 digits behind the decimal mark, |
78 |
|
- % but correct with only 2 (default). |
79 |
|
- \displayprecision{4} |
80 |
|
-``` |
81 |
|
- |
82 |
|
-```LaTeX |
83 |
|
- % The following is NOT allowed, |
84 |
|
- % since displayprecision (default 2) is now smaller then the correctorprecision |
85 |
|
- \correctorprecision{4} |
86 |
|
-``` |
87 |
|
- |
88 |
|
-<div class="alert green"> |
89 |
|
-When a function was created using the <i>calculate</i> option, the precision defined with the above command will be ignored. |
90 |
|
-This is because computations should not be rounded while not visible to the user. In case you do want to |
91 |
|
-display the calculated value then set the precision within the |
92 |
|
-<a href="How-write-questions-and-answers">function command</a>. |
93 |
|
-Again this value should be $$\geq$$ corrector precision. |
94 |
|
-</div> |
95 |
|
- |
96 |
|
-## Type : Input Function |
97 |
|
- |
98 |
|
-If the question has the type _input.function_, then it is appropriate to compare the user's answer _numerically_ with the pre-given solution. |
|
69 |
+What happens in the code: |
|
70 |
+* Between **\begin{variables}** and **\end{variables}** three variables are defined, namely |
|
71 |
+a number `a` having the value 11, a number `b` having the value 16, and a variable `f` which |
|
72 |
+is equal to the fraction $$\frac{a}{b}=\frac{11}{16}$$, and which will be displayed as |
|
73 |
+$$\frac{11}{16}$$. |
|
74 |
+* **\type{input.number}**: all answers demand for a number as input. |
|
75 |
+* **\field{real}**: Numbers are treated as decimal numbers and corrected as those |
|
76 |
+(see [Number fields](number-fields.md) for more details). |
|
77 |
+* **\displayprecision{3}** and **\correctorprecision[rounded]{3}**: Determine to which |
|
78 |
+precision numbers are displayed and corrected |
|
79 |
+(see [Precision for real numbers](number-fields.md#precision-of-real-numbers) for more details). |
|
80 |
+* **\text{Determine ...}**: This is the text shown at the beginning of the question. |
|
81 |
+It accepts LaTeX-style text as argument. Variables can be displayed via the command `\var{..}`, |
|
82 |
+ which should usually be enclosed in $-signs for correct mathematical display. |
|
83 |
+* **\explanation{Think...}**: Text that is shown if at least one answer was incorrect. |
|
84 |
+* The answer block is embraced with **\begin{answer}** and **\end{answer}**. |
|
85 |
+* **\text{Answer: }** Text that will be placed _in front_ of the answer (input) field |
|
86 |
+* **\explanation{The explanation ...}**: Text that is shown if the answer of this |
|
87 |
+ answer block was incorrect. |
|
88 |
+* **\solution{f}** the student input will be compared to the value of the variable `f`. As |
|
89 |
+`\correctorprecision` is set to 3 with argument _rounded_, the input will be marked as correct, |
|
90 |
+if it equals the value of `f` rounded to the third decimal place. |
|
91 |
+ |
|
92 |
+ |
|
93 |
+ |
|
94 |
+# Type : Input Function |
|
95 |
+ |
|
96 |
+If the question has the type _input.function_, then there are several ways to check |
|
97 |
+the user's answer for correctness. |
|
98 |
+The simplest way is to compare the user's answer _numerically_ with the pre-given solution. |
99 |
99 |
This can be done using the command `\checkAsFunction`. Here is an example: |
100 |
100 |
|
101 |
101 |
```LaTeX |
... |
... |
@@ -118,19 +118,33 @@ This can be done using the command `\checkAsFunction`. Here is an example: |
118 |
118 |
\end{question} |
119 |
119 |
``` |
120 |
120 |
|
|
121 |
+The syntax for `\checkAsFunction` is explained in the next paragraph. |
|
122 |
+ |
|
123 |
+If one has to refer to the user's input in this or a later correction, e.g. when using the |
|
124 |
+corrector command `\checkFuncForZero`, one can give it a variable name using the command |
|
125 |
+**\inputAsFunction{x}{t}**. Here the first argument (x) is a comma separated list of free |
|
126 |
+variables that the user is allowed to use for input, and the second argument (t) is the |
|
127 |
+name which can be used later on. |
|
128 |
+ |
|
129 |
+**Warning**: Whitespaces in the list are not allowed. |
|
130 |
+ |
|
131 |
+See also the examples for [\checkStringsForRelation](input.fields.md#3-checkstringsforrelation), |
|
132 |
+[\checkFuncForZero](input.fields.md#4-checkfuncforzero), |
|
133 |
+and [Multivariate Functions](input.fields.md#multivariate-functions). |
|
134 |
+ |
121 |
135 |
## Corrector commands of input.function |
122 |
136 |
|
123 |
|
-### 1. \checkAsFunction |
|
137 |
+## 1. \checkAsFunction |
124 |
138 |
|
125 |
139 |
The corrector now compares the values of the function entered by the user to those of the function $$f = x^2+7x$$ at one |
126 |
140 |
hundred randomly chosen points (_steps_) between -10 (_min_) and 10 (_max_) and accepts the solution if and only if |
127 |
141 |
none of these differ by more than the standard $$epsilon = 1E-8.$$ I.e. $$|\text{UserAnswer} - \text{CorrectAnswer}| < 10^{-8}$$ |
128 |
142 |
So the syntax is given by `\checkAsFunction{ _variable_}{ _min_}{ _max_}{ _steps_}`. |
129 |
|
-In case you wish to use a different tolerance value _epsilon_ instead of the default 1E-8, you may submit it by an optional parameter: |
|
143 |
+In case you wish to use a different tolerance value _epsilon_ instead of the default 1E-8, you may provide it by an optional parameter: |
130 |
144 |
|
131 |
145 |
`\checkAsFunction[ _epsilon_]{ _variable_}{ _min_}{ _max_}{ _steps_}`. |
132 |
146 |
|
133 |
|
-In fact, the implemented comparison method uses randomly chosen points (as mentioned), and it does not take into account points, where the function f takes values which are very large. |
|
147 |
+In fact, the implemented comparison method uses randomly chosen points (as mentioned), and it does not take into account points, where the function `f` takes values which are very large. |
134 |
148 |
These points are excluded for reasons of numerical stability. 'Very large' means larger in absolute value than the default $$cutoff = 1E5$$. |
135 |
149 |
If you have to take into account a situation, where the correct result is determined only up to a constant (because the user is expected to find an indefinite integral, e.g.), |
136 |
150 |
you can change the behavior of the method accordingly. So there is another extended syntax: |
... |
... |
@@ -154,7 +168,7 @@ The consequence of using `\checkAsFunction` with that syntax is that |
154 |
168 |
Observe that in case you want to use this extended syntax version, <b>you have to fill in all four fields, with '|' as separator</b>. |
155 |
169 |
</div> |
156 |
170 |
|
157 |
|
-### 2. \allowForInput |
|
171 |
+## 2. \allowForInput |
158 |
172 |
|
159 |
173 |
With the command `\allowForInput[true|false]{<expression list>}` you can decide if some operations or symbols are |
160 |
174 |
permitted/prohibited for answer input. The default value for the optional argument is **true**. The entries in the |
... |
... |
@@ -164,6 +178,8 @@ expression list should be separated by blanks. Remarks: |
164 |
178 |
digits or numbers by setting the optional command to **false**. |
165 |
179 |
|
166 |
180 |
In the following examples (i) _sin_ and _pi_ are excluded from input, so the user can't give the given task as answer. |
|
181 |
+As the user also shouldn't give any free variable, the first parameter of `\checkAsFunction` |
|
182 |
+(which contains the list of free variables) can just be left empty. |
167 |
183 |
|
168 |
184 |
```LaTeX |
169 |
185 |
\begin{problem} |
... |
... |
@@ -183,6 +199,7 @@ In the following examples (i) _sin_ and _pi_ are excluded from input, so the use |
183 |
199 |
\text{$ \var{f} = $} |
184 |
200 |
\solution{f} |
185 |
201 |
\allowForInput[false]{sin pi} |
|
202 |
+ \checkAsFunction{}{-1}{1}{10} |
186 |
203 |
\end{answer} |
187 |
204 |
|
188 |
205 |
\end{question} |
... |
... |
@@ -190,7 +207,7 @@ In the following examples (i) _sin_ and _pi_ are excluded from input, so the use |
190 |
207 |
\end{problem} |
191 |
208 |
``` |
192 |
209 |
|
193 |
|
-### 3. \checkStringsForRelation |
|
210 |
+## 3. \checkStringsForRelation |
194 |
211 |
|
195 |
212 |
Any answers by a user to a problem (called user input) can be |
196 |
213 |
- corrected using the command _equal()_, |
... |
... |
@@ -225,7 +242,8 @@ Remarks: |
225 |
242 |
* If you use `\checkStringsForRelation` you need _equal()_ (see the following example) as part of your conditions if |
226 |
243 |
you want an equals check with the correct solution. If you don't use _equal()_ there |
227 |
244 |
will be no equals check. Here is list of possible [relations](Expression-Syntax-For-Generic-Applets). |
228 |
|
-* Observe that by default, the identity of operations with _equal()_ is tested here algebraically, not numerically. But you can use `\checkAsFunction` (see above) in addition to achieve a numerical comparison instead. |
|
245 |
+* Observe that by default, the identity of operations with _equal()_ is tested here algebraically, not numerically. |
|
246 |
+But you can use `\checkAsFunction` (see above) in addition to achieve a numerical comparison instead. |
229 |
247 |
|
230 |
248 |
```LaTeX |
231 |
249 |
\begin{problem} |
... |
... |
@@ -251,7 +269,7 @@ will be no equals check. Here is list of possible [relations](Expression-Syntax- |
251 |
269 |
\end{question} |
252 |
270 |
``` |
253 |
271 |
|
254 |
|
-### 4. Check of a functional of answers (checkFuncForZero) |
|
272 |
+## 4. \checkFuncForZero |
255 |
273 |
|
256 |
274 |
In some cases, the correct user answer is not unique. For instance, if the user is expected to find two functions $$f$$, $$g$$ with $$f[g] = sqrt(2x^2+1)$$ , the number of possible correct answers is unlimited. |
257 |
275 |
So $$f(y) = sqrt(2y+1)$$ with $$g(x) = x^2$$ or $$f(y) = sqrt(y)$$ with $$g(x) = 2x^2+1$$ is correct, as well as $$f = sqrt(y+1)$$ with $$g(x) = 2x^2$$,... |
... |
... |
@@ -336,7 +354,7 @@ Finally, you may use the syntax $$D[f]$$ to refer to the derivative of a functio |
336 |
354 |
\end{question} |
337 |
355 |
``` |
338 |
356 |
|
339 |
|
-### 5. Multivariate Functions |
|
357 |
+## Multivariate Functions |
340 |
358 |
|
341 |
359 |
#### inputAsFunction, checkAsFunction |
342 |
360 |
|
... |
... |
@@ -420,107 +438,67 @@ to which you want to compute the derivative of the function. |
420 |
438 |
\end{question} |
421 |
439 |
``` |
422 |
440 |
|
423 |
|
-## Permutable answers |
|
441 |
+# Input function cases questions |
424 |
442 |
|
425 |
|
-In case the solutions of a question are a set, i.e. the answers $$x_1$$, $$x_2$$, $$x_3$$ are interchangeable, |
426 |
|
-the answers must be permutable (e.g. the roots $$x_1$$ , $$x_2$$ and $$x_3$$ of a cubic equation). This can be achieved |
427 |
|
-with the command `\permuteAnswers` which takes a comma separated list of answer indices (numbering starts with one). |
|
443 |
+Another input type in the generic framework is **input.cases.function**. This type is designed for case |
|
444 |
+differentiations of e.g. absolute value functions. **Note** that you can only use this input type in an |
|
445 |
+answer environment. The questions input type has to be set to **input.generic**. |
428 |
446 |
|
429 |
|
-Currently this functionality is only available for questions with the types: |
|
447 |
+In answer you must use the command `\solution{<variable>=<if-else expression>}` where **variable** is an |
|
448 |
+identifier of an in the _variables environment_ defined variable. With the if-else expression a correct solution |
|
449 |
+is defined. The syntax should be as followed: `IFELSE{<if condition>}{<then implication>}{<else implication>}`. |
430 |
450 |
|
431 |
|
-* input.number |
432 |
|
-* input.function (*WARNING: not available if \inputAsFunction is used*) |
433 |
|
-* input.finite-number-set |
434 |
|
-* input.interval |
435 |
|
-* input.matrix |
|
451 |
+The else implication can be another if-else expression. |
|
452 |
+ |
|
453 |
+The answer of the user is checked numerically in a default (or by the author defined) range **and** in dependence |
|
454 |
+of the users given answer. At the moment you can use the following commands in the answer environment: |
436 |
455 |
|
437 |
|
-**The function can't be used if you have different answer types in one question!** |
|
456 |
+* `\checkAsFunction` (see above for details) to customize the numeric comparison |
|
457 |
+The default parameters of `\checkAsFunction` in input.cases.function are set to: |
|
458 |
+$$min = -100$$, $$max = 100$$, $$steps = 300$$, $$epsilon = 1E-8$$. |
|
459 |
+* `\allowForInput` (see above for details) to limit the users input for the implications in the case |
|
460 |
+differentiation |
|
461 |
+* `\allowForConditionInput` (analog to \allowForInput) to limit the users input for the conditions in |
|
462 |
+the case differentiation |
438 |
463 |
|
439 |
|
-The following example demonstrates this technique for a question with two answers (index 1 and 2): |
|
464 |
+An example: |
440 |
465 |
|
441 |
466 |
```LaTeX |
442 |
|
-begin{question} |
443 |
|
- \text{What are the roots of f(x)=$\var{f}$ ?} |
444 |
|
- \explanation{} |
445 |
|
- \type{input.number} |
446 |
|
- \field{real} |
447 |
|
-``` |
|
467 |
+\begin{problem} |
448 |
468 |
|
449 |
|
-```LaTeX |
450 |
|
- \permuteAnswers{1, 2, 3} |
451 |
|
-``` |
|
469 |
+ \begin{question} |
452 |
470 |
|
453 |
|
-```LaTeX |
|
471 |
+ \type{input.cases.function} |
|
472 |
+ \text{Fallunterscheidung, distinguish cases} |
454 |
473 |
|
455 |
|
- \begin{answer} |
456 |
|
- \text{$x_1 = $} |
457 |
|
- \solution{a} |
458 |
|
- \end{answer} |
|
474 |
+ \begin{variables} |
|
475 |
+ \function{g}{abs(abs(x-1)+2x)} |
|
476 |
+ \function{h}{sin(x)} |
|
477 |
+ \end{variables} |
459 |
478 |
|
460 |
479 |
\begin{answer} |
461 |
|
- \text{$x_2 = $} |
462 |
|
- \solution{b} |
|
480 |
+ \text{$\var{g} =$} |
|
481 |
+ \solution{g=IFELSE{x>=1}{3x-1}{IFELSE{x<-1}{-x-1}{x+1}}} |
|
482 |
+ \allowForInput[false]{abs} |
|
483 |
+ \allowForConditionInput[false]{abs} |
463 |
484 |
\end{answer} |
464 |
485 |
|
465 |
486 |
\begin{answer} |
466 |
|
- \text{$x_3 = $} |
467 |
|
- \solution{c} |
|
487 |
+ \text{$(\sin(x))^2+(\cos(x))^2=1$. Bestimme für $0\le x\le 2\pi$ $\var{h} =$} |
|
488 |
+ \solution{h=IFELSE{0<=x<=pi}{sqrt(1-(cos(x)^2))}{-sqrt(1-(cos(x)^2))}} |
|
489 |
+ \allowForInput[false]{sin} |
|
490 |
+ \allowForConditionInput[false]{sin} |
|
491 |
+ \checkAsFunction[1E-6]{x}{0}{6.283}{100} |
468 |
492 |
\end{answer} |
469 |
493 |
|
470 |
|
- \begin{variables} |
471 |
|
- \function[expand]{f}{(x-a)(x-b)(x-c)} |
472 |
|
- \randint[Z]{a}{-5}{5} |
473 |
|
- \randint[Z]{b}{-5}{5} |
474 |
|
- \randint[Z]{c}{-5}{5} |
475 |
|
- \randadjustIf{a,b,c}{a=b OR a=c OR b=c} |
476 |
|
- \end{variables} |
477 |
|
-\end{question} |
478 |
|
-``` |
479 |
|
- |
480 |
|
-## Adjust randomized variables |
481 |
|
- |
482 |
|
-If you randomize variables, it could happen that the random values do not satisfy some conditions the author wishes to |
483 |
|
-be fulfilled in the question, or that the problem is not correctly posed for some combinations of the random values. |
484 |
|
-So they have to be adjusted. Therefore, you can use the following syntax to achieve this: |
485 |
|
- |
486 |
|
-`\randadjustIf{ _list_of_variables_ }{ _avoidance_relation_ }` |
|
494 |
+ \end{question} |
487 |
495 |
|
488 |
|
-*Example* |
|
496 |
+\end{problem} |
489 |
497 |
|
490 |
|
-```LaTeX |
491 |
|
-\begin{variables} |
492 |
|
- \randint{a}{2}{5} |
493 |
|
- \randint[Z]{b}{-5}{5} |
494 |
|
- \randint{c}{2}{5} |
495 |
|
- \randint{d}{-4}{4} |
496 |
|
- \randadjustIf{a,b,c}{a^2+b^2 > c^2 OR a=b} |
497 |
|
-\end{variables} |
498 |
498 |
``` |
499 |
499 |
|
500 |
|
-This has the following consequence: |
501 |
|
-If the random integer point $$[a,b]$$ is outside the circle (centered at the origin) with radius $$c$$, or if it is situated |
502 |
|
-at the main diagonal, then new values for $$a$$,$$b$$ and $$c$$ are picked up randomly, possibly several times, until the |
503 |
|
-given **avoidance condition** is no longer fulfilled. |
504 |
|
- |
505 |
|
-The **list_of_variables** is a comma separated list which contains those **random** variables of the **same** variables |
506 |
|
-environment, for which the author wishes adjustment in case the **avoidance_relation** is fulfilled. |
507 |
500 |
|
508 |
|
-This avoidance_relation has to be a logical (boolean) combination (use $$NOT$$, $$AND$$, $$OR$$) of simple comparison |
509 |
|
-relations $$(=, !=, <, <=, >, >=)$$ between **expressions** in the variables. |
510 |
|
- |
511 |
|
-These expressions may include **random and non-random** variables defined in the same environment. |
512 |
|
- |
513 |
|
-See [Expressions And Relations](Expressions-And-Relations) for a more detailed description. |
514 |
|
- |
515 |
|
-*Hint*: |
516 |
|
- |
517 |
|
-* Make sure that the avoidance relation can be avoided at all for the random variables with the ranges given. |
518 |
|
-The `\randint` commands jointly define a product set which has to have a non-empty intersection with the |
519 |
|
-complement of the avoidance set. Otherwise you get a runtime error when the problem is run. |
520 |
|
-* Even if the intersection is non-empty but has a equi-distribution probability being too small, |
521 |
|
-a runtime error might be the result, though the algorithm tries its best to find an admissible point. |
522 |
|
- |
523 |
|
-## Input matrix questions |
|
501 |
+# Input matrix questions |
524 |
502 |
|
525 |
503 |
If the solution to a question is a row vector, a column vector or a matrix, the generic problem is of the type input.matrix. |
526 |
504 |
|
... |
... |
@@ -642,7 +620,7 @@ Example: |
642 |
620 |
\embedapplet{applet} |
643 |
621 |
``` |
644 |
622 |
|
645 |
|
-## Input text questions |
|
623 |
+# Input text questions |
646 |
624 |
|
647 |
625 |
A new question type **input.text** has been implemented in generic framework. |
648 |
626 |
In generic problem TeX files a new variable type `\string{ varname }{ string-content }` can be used. |
... |
... |
@@ -758,65 +736,73 @@ Here is an example: |
758 |
736 |
|
759 |
737 |
``` |
760 |
738 |
|
761 |
|
-## Input function cases questions |
|
739 |
+# Input interval |
762 |
740 |
|
763 |
|
-Another input type in the generic framework is **input.cases.function**. This type is designed for case |
764 |
|
-differentiations of e.g. absolute value functions. **Note** that you can only use this input type in an |
765 |
|
-answer environment. The questions input type has to be set to **input.generic**. |
|
741 |
+The type input.interval is explained on the page [Interval](Interval.md) |
766 |
742 |
|
767 |
|
-In answer you must use the command `\solution{<variable>=<if-else expression>}` where **variable** is an |
768 |
|
-identifier of an in the _variables environment_ defined variable. With the if-else expression a correct solution |
769 |
|
-is defined. The syntax should be as followed: `IFELSE{<if condition>}{<then implication>}{<else implication>}`. |
|
743 |
+# Futher options on input field questions |
770 |
744 |
|
771 |
|
-The else implication can be another if-else expression. |
|
745 |
+## Permutable answers |
772 |
746 |
|
773 |
|
-The answer of the user is checked numerically in a default (or by the author defined) range **and** in dependence |
774 |
|
-of the users given answer. At the moment you can use the following commands in the answer environment: |
|
747 |
+In case the solutions of a question are a set, i.e. the answers $$x_1$$, $$x_2$$, $$x_3$$ are interchangeable, |
|
748 |
+the answers must be permutable (e.g. the roots $$x_1$$ , $$x_2$$ and $$x_3$$ of a cubic equation). This can be achieved |
|
749 |
+with the command `\permuteAnswers` which takes a comma separated list of answer indices (numbering starts with one). |
775 |
750 |
|
776 |
|
-* `\checkAsFunction` (see above for details) to customize the numeric comparison |
777 |
|
-The default parameters of `\checkAsFunction` in input.cases.function are set to: |
778 |
|
-$$min = -100$$, $$max = 100$$, $$steps = 300$$, $$epsilon = 1E-8$$. |
779 |
|
-* `\allowForInput` (see above for details) to limit the users input for the implications in the case |
780 |
|
-differentiation |
781 |
|
-* `\allowForConditionInput` (analog to \allowForInput) to limit the users input for the conditions in |
782 |
|
-the case differentiation |
|
751 |
+Currently this functionality is only available for questions with the types: |
783 |
752 |
|
784 |
|
-An example: |
|
753 |
+* input.number |
|
754 |
+* input.function (*WARNING: not available if \inputAsFunction is used*) |
|
755 |
+* input.finite-number-set |
|
756 |
+* input.interval |
|
757 |
+* input.matrix |
785 |
758 |
|
786 |
|
-```LaTeX |
787 |
|
-\begin{problem} |
|
759 |
+**The command \permuteAnswers can't be used if you have different answer types in one question!** |
788 |
760 |
|
789 |
|
- \begin{question} |
|
761 |
+The following example demonstrates this technique for a question with three answers |
|
762 |
+(index 1, 2 and 3): |
790 |
763 |
|
791 |
|
- \type{input.cases.function} |
792 |
|
- \text{Fallunterscheidung, distinguish cases} |
|
764 |
+```LaTeX |
|
765 |
+begin{question} |
|
766 |
+ \text{What are the roots of f(x)=$\var{f}$ ?} |
|
767 |
+ \explanation{} |
|
768 |
+ \type{input.number} |
|
769 |
+ \field{real} |
|
770 |
+``` |
793 |
771 |
|
794 |
|
- \begin{variables} |
795 |
|
- \function{g}{abs(abs(x-1)+2x)} |
796 |
|
- \function{h}{sin(x)} |
797 |
|
- \end{variables} |
|
772 |
+```LaTeX |
|
773 |
+ \permuteAnswers{1, 2, 3} |
|
774 |
+``` |
|
775 |
+ |
|
776 |
+```LaTeX |
798 |
777 |
|
799 |
778 |
\begin{answer} |
800 |
|
- \text{$\var{g} =$} |
801 |
|
- \solution{g=IFELSE{x>=1}{3x-1}{IFELSE{x<-1}{-x-1}{x+1}}} |
802 |
|
- \allowForInput[false]{abs} |
803 |
|
- \allowForConditionInput[false]{abs} |
|
779 |
+ \text{$x_1 = $} |
|
780 |
+ \solution{a} |
804 |
781 |
\end{answer} |
805 |
782 |
|
806 |
783 |
\begin{answer} |
807 |
|
- \text{$(\sin(x))^2+(\cos(x))^2=1$. Bestimme für $0\le x\le 2\pi$ $\var{h} =$} |
808 |
|
- \solution{h=IFELSE{0<=x<=pi}{sqrt(1-(cos(x)^2))}{-sqrt(1-(cos(x)^2))}} |
809 |
|
- \allowForInput[false]{sin} |
810 |
|
- \allowForConditionInput[false]{sin} |
811 |
|
- \checkAsFunction[1E-6]{x}{0}{6.283}{100} |
|
784 |
+ \text{$x_2 = $} |
|
785 |
+ \solution{b} |
812 |
786 |
\end{answer} |
813 |
787 |
|
814 |
|
- \end{question} |
815 |
|
- |
816 |
|
-\end{problem} |
|
788 |
+ \begin{answer} |
|
789 |
+ \text{$x_3 = $} |
|
790 |
+ \solution{c} |
|
791 |
+ \end{answer} |
817 |
792 |
|
|
793 |
+ \begin{variables} |
|
794 |
+ \function[expand]{f}{(x-a)(x-b)(x-c)} |
|
795 |
+ \randint[Z]{a}{-5}{5} |
|
796 |
+ \randint[Z]{b}{-5}{5} |
|
797 |
+ \randint[Z]{c}{-5}{5} |
|
798 |
+ \randadjustIf{a,b,c}{a=b OR a=c OR b=c} |
|
799 |
+ \end{variables} |
|
800 |
+\end{question} |
818 |
801 |
``` |
819 |
802 |
|
820 |
|
-## Input interval |
|
803 |
+## Consecutive errors |
821 |
804 |
|
822 |
|
-The type input.interval is explained on the page [Interval](Interval.md) |
|
805 |
+The automatic correction of generic TeX problems can take into account consecutive errors. This feature is only |
|
806 |
+available for questions of type `input.number` or `input.function`. |
|
807 |
+ |
|
808 |
+More details in [Advanced Programming](advanced-topics.md#consecutive-errors) |
823 |
809 |
|