version 1.4, 2013/07/05 18:30:40
|
version 1.5, 2013/07/08 03:29:27
|
Line 1
|
Line 1
|
\label{Tolerance} |
\label{Tolerance} |
A \textbf{tolerance\index{tolerance}} parameter determines how closely |
A \textbf{tolerance\index{tolerance}} parameter determines how closely |
the system will require the student's answer to be in order to count it correct. |
the system will require the student's answer to be in order to count it correct. |
The tolerance parameter should always be defined for a numerical problem. |
The tolerance will default to zero if it is not defined. |
|
The tolerance parameter should always be defined for a numerical problem |
|
unless you are certain only integer answers are generated from your script and |
|
you want students to reply with exactly that integer. |
|
|
For technical reasons, it is almost never a good idea to set this parameter |
If the computer answer is a floating point number, the tolerance should not |
to zero. Computers can only approximate computations involving real numbers. For instance, |
be zero. Computers can only approximate computations involving real numbers. For instance, |
a computer's {[}decimal{]} answer to the simple problem $\frac{1}{3}$ is |
a computer's {[}decimal{]} answer to the simple problem $\frac{1}{3}$ is |
{}``0.33333333333333331''. It \emph{should} be an infinite series of 3's, |
{}``0.33333333333333331''. It \emph{should} be an infinite series of 3's, |
and there certainly shouldn't be a {}``1'' in the answer, but no computer |
and there certainly shouldn't be a {}``1'' in the answer, but no computer |
can represent an infinitely long, infinitely detailed real number. Therefore, |
can represent an infinitely long, infinitely detailed real number. Therefore, |
for any problem where the answer is not a small integer, you \emph{need} |
for any problem where the answer is not an integer, you \emph{need} |
to allow a tolerance factor, or the students will find it nearly impossible |
to allow a tolerance factor, or the students will find it nearly impossible |
to exactly match the computers idea of the answer. You may find the |
to exactly match the computer's idea of the answer. You may find the |
default too large for some problems. |
default tolerance too large for some problems, so adjust as appropriate. |
|
|
There are |
There are three kinds of tolerance. For some answer $A$ and a tolerance $T$, |
three kinds of tolerance. For some answer $A$ and a tolerance $T$, |
|
|
|
\begin{enumerate} |
\begin{enumerate} |
\item an \textbf{Absolute} tolerance\index{absolute tolerance}\index{tolerance, absolute} |
\item an \textbf{Absolute} tolerance\index{absolute tolerance}\index{tolerance, absolute} |
Line 37 $\$X-\$tolerance$ to $\$X+\$tolerance$.
|
Line 39 $\$X-\$tolerance$ to $\$X+\$tolerance$.
|
close to zero are possible for some students) |
close to zero are possible for some students) |
|
|
\end{enumerate} |
\end{enumerate} |
|
|
|
Some care is necessary when setting the display format of the computer answer. |
|
Before testing the tolerance, LON-CAPA converts the computer answer, |
|
as generated in the script block, according to the |
|
format attribute in the numericalresponse tag. |
|
|
|
Next, the formatted compuer answer is "graded" relative to the significant |
|
figures parameter, if it is set (see section \ref{Significant_Figures}. |
|
If that test was passed, then a numerical comparison of the Computer's |
|
answer is made with the range of values: |
|
|
|
(\$computerAnswer - \$tolerance) < \$formattedcomputerAnswer < |
|
(\$computerAnswer + \$tolerance) |
|
|
|
If the \$formattedcomputerAnswer satisfies the permitted range, then |
|
"correct" is returned for the computer answer. It is good idea to test multiple |
|
randomizations to make sure that your tolerance is compatible with the display format. |
|
|
|
|