The Numeric question type accepts either a number in decimal or scientific notation, or a number with units for an answer.
You must specify units as an optional argument to the \answer macro. For example:
\answer[m/s^2]{9.8}
Because it is natural to specify the units after the number, you can use the format:
\answer{9.8}[m/s^2]
Notes:
In the correct answer, the number must be enclosed in braces "{ }". The units must be enclosed in brackets "[ ]".
If you do not specify units in the correct answer (that is, if you do not specify an argument to \answer), the system presents the student with a single text field in which to enter a response (without units). If you specify an argument to \answer, that argument is taken as the correct answer's units. In this case, the system displays two text fields. A student must enter the numerical part of the response in the first field and the units in the second field
You must use recognized units.
To define a custom list of units in a question
bank, use the \TableOfUnits command in the
LaTeX document's preamble (that is, before \begin{document}
and after \usepackage{ed}). The \TableOfUnits
command takes two required arguments, in the following order:
tablename
- table name, consisting of lower-case letters (a-z) with no spaces. Use the table name
to reference the table in the document.
units_list
- the list of acceptable units. Units are defined with statements defining
the units in terms of SI units or previously defined units. Each statement
must end with a semicolon. For example:
cm
= 0.01m;
mm
= 0.1cm;
The base SI units are:
m (meter)
kg (kilogram)
s (second)
A (amp)
K (kelvin)
cd (Candela)
To use a custom list of units in a question, use the \units{tablename} command in the body of the question, where tablename is the table name (the first argument to \TableOfUnits).
Important: Because the system converts between systems of units using inexact conversion factors, it is recommended that you accept responses in a margin of error in questions with units.
The Numeric question type has five distinct types of grading. Descriptions are given below, followed by usage instructions and examples.
Exact value - the student response must match the value given in the \answer field. There is no error tolerance. If you do not specify any other commands, this behavior is used.
Exact value
and number of significant digits - the student response must agree
with the value given in the \answer field
and contain the specified number
of significant digits.
Specify the number of significant digits using the \digits{n}
command, where n is the number of significant
digits.
For example, using \digits{3} with
\answer{2.5}, only 2.50
is graded correct.
Absolute
tolerance - the student response must agree with the value given
in the \answer field to within a specified
tolerance.
Specify the absolute tolerance using the \err{error}
command, where error is the absolute tolerance.
For example, using \err{0.25} with
\answer{2.5}, any response between 2.25
and 2.75 (inclusive) is graded correct. For
example, 2.333333 is correct.
Significant
digits with tolerance - the student response must agree with the
value given in the \answer field to within
a specified tolerance in the nth
significant digit.
Specify the tolerance using the \err{k}
and \digits{n} commands, where k
is the tolerance in the nth
significant digit.
For example, using \err{2} and \digits{3} (tolerance of 2
at the third significant digit) with \answer{2.5},
any response between 2.48 and 2.52
(inclusive) is graded correct. For example, 2.4999999
is correct.
Relative
tolerance - the student response must agree with the value given
in the \answer field to within a specified
percent error.
Specify the percent tolerance using the \perc{error}
command, where error is the percent.
For example, using \perc{5} with \answer{2.5}, any response between 2.5
* 0.95 and 2.5 * 1.05 (inclusive) is
graded correct. For example, 2.388888 is correct.
Consider the following recommendations when using this question type.
In general, allow some tolerance in a student response
Provide a correct answer that is as accurate as possible.
If the use of units is not an important part of the question (that is, you are not testing the student's ability to convert units), do not include units in the \answer field. In this case, instruct the students to enter a purely numeric response in terms of a unit you specify.
\begin{question}{numeric}
\qutext{Compute the exact value of the function $f(x)=3x^4-2x^2-1$ at
$x=2.1$.}
\answer{48.5243} % exact value grading
\end{question}
\begin{question}{numeric}
\qutext{Compute the value of $\log(45)$. Round your answer to 5
significant digits.}
\answer{1.6532} % This question uses exact grading because \digits is not used
% In this case, a more accurate response is graded incorrect.
\end{question}
\begin{question}{numeric}
\qutext{Compute the value of $\log(45)$. Your answer must be correct
to at least 5 decimal places.}
\answer{1.653212514}
\err{0.00001} % absolute tolerance
% Any numerical response between 1.653202514 and 1.653222514 is
% graded correct.
\end{question}
\begin{question}{numeric}
% This question uses algorithmic variables.
\qutext{Compute the value of $\log(\var{a})$. Your answer must be
correct to at least 5 decimal places.}
\answer{\var{ans}}
\err{0.00001}
\code{
$a=rand(1,100,4);
$ans=log($a);
}
% The above code chooses a random value a between 1 and 100, to four
% significant figures. The value of log(a) is then calculated.
\end{question}
\begin{question}{numeric}
\qutext{A man is on the top of a tower that is 800 feet above ground.
How far can he see?
\newline\newline
Use 3960 miles for the radius of the earth.\newline
Express your answer to an accuracy of at least 6 significant digits.}
\answer{34.64134750325308}[mi]
\err{0.0001} % Note: Using \digits{6} would allow no tolerance, and would
% cause '182906 ft' and '34.6413 mi' to be graded incorrect
% because the values do not match the correct answer.
\end{question}
\begin{question}{numeric}
% If the ability to convert units is not an important part of the
% question, do not use units.
\qutext{A cat is on the top of a tower that is 800 feet above ground.
How far (in miles) can it see?
\newline\newline
Use 3960 miles for the radius of the earth.\newline
Express your answer to an accuracy of at least 4 decimal places.\newline
Do NOT include any units in your answer.}
\answer{34.64134750325308}
\err{0.0001}
\end{question}
\begin{question}{numeric}
% An algorithmic version of the previous question.
% The height is a multiple of 50 in [400,900).
\code{$height = int(range(400,900,50));
$answer = sqrt((3960 + $height/5280)^2 - 3960^2);}
\qutext{A woman is on the top of a tower that is \var{height} feet above
ground. How far (in miles) can she see?
\newline\newline
Use 3960 miles for the radius of the earth.\newline
Express your answer to an accuracy of at least 6 significant digits.}
\answer[mi]{\var{answer}}
\err{2} % Accept any response within +/- 2 units
\digits{6} % in the sixth significant digit.
\end{question}