Calculated questions offer a way to create individual numerical questions using of wildcards that are substituted with individual values when the quiz is taken.
Example:
Question: | |
---|---|
Image to display: | |
Correct Answer Formula: | |
Tolerance: | ± |
Tolerance Type: | |
Significant Figures: |
The {a} and {b} and any other {name} can be used as a wildcard that is substituted by a value when the quiz is taken. The correct answer is calculated when the quiz is
submitted using the expression in "Correct Answer Formula," which is calculated as a numerical expression after the substitution of the wildcards.
The possible wildcard values are set or generated on a later page of the question form.
The example formula uses the operator +. Other accepted operators are -*/ and % (where % is the modulo operator).
You can use PHP-style mathematical
functions. There are 24 single-argument functions:
abs, acos, acosh, asin, asinh, atan, atanh, ceil, cos, cosh, deg2rad, exp, expm1, floor, log, log10, log1p, rad2deg, round, sin, sinh, sprt, tan, tanh
some two-argument functions:
atan2, pow
and the functions min and max which can also take two or more arguments.
It is also possible to use the function pi which
takes no arguments, but do not forget to use parentheses: the correct usage is pi(). Similarly, the other functions must
have their argument(s) within parentheses, for example, sin({a}) + cos({b}) * 2.
You can wrap functions within each other, for example, cos(deg2rad({a} + 90)) etc.
More details on how to use these PHP-style functions can be found in the documentation
at the PHP web site
It is possible to allow a margin within which all responses are accepted as correct. The "Tolerance" field is used for this. There are three different types of tolerances. These are Relative, Nominal and Geometric. For example, if the correct answer at quiz time is calculated to 200 and the tolerance is set to 0.5, the different tolerance types work like this:
Relative: A tolerance interval is calculated by multiplying the correct answer with, in this case, 0.5, for an answer of 100. For this tolerance, the correct response must be between 100 and 300. (200 ± 100). This is useful if the magnitude of the correct answer can differ greatly between different wildcard values.
Nominal: This is the simplest tolerance type but not very powerful. The correct response must be between 199.5 and 200.5 (200 ± 0.5). This tolerance type can be useful if the differences between different correct answers are small.
Geometric: The upper limit of the tolerance interval is calculated as 200 + 0.5*200 and is the same as for the relative case. The lower limit is calculated as 200/(1 + 0.5). The correct response must then be between 133.33 and 300. This is useful for complex calculations that must have great tolerances where relative tolerances of 1 or more would be used for the upper limit but would not be acceptable for the lower limit (because doing so would make zero a correct answer for all cases).
The field Significant Figures only relates to how the correct answer should be presented in the review or the reports. For example, if it is set to 3, the correct answer 13.333 would be presented as 13.3, 1236 would be presented as 1240. and 23 would be presented as 23.0.
The feedback field and the optional unit fields work in the same way as they do for numerical questions.