Formula Questions in LaTeX

Question Mode: Formula

 

The Formula question type is the most general math question type. Answers can be any kind of formula, entered in calculator syntax, or using the system Symbolic Editor entry mode. Independent of entry method, answers are encoded as MathML, enabling the system to grade equivalent answers correctly. Answers can include variables and standard functions.

 

Notes

For example, if the answer field were

  {2.34 ? 0.01}

any response between 2.33 and 2.35 (inclusive) would be graded correct.  In other words, the number following the ? operator is the margin of error. For more information on tolerances, see Setting a Margin of Error in Non-numeric Questions.

Example 1

\begin{question}{Formula}
\qutext{What is the derivative of $x^3+3\cos(x)-1$?}
% Use calculator syntax for the answer, not TeX.
\answer{3x^2-3*sin(x)}
\end{question}

Example 2

\begin{question}{Formula}
\qutext{Compute the exact value of $f'(2)$ if $f(x)=x^3+3\cos(x)-1$.}
\answer{12-3*sin(2)}
% Any numerical approximation is graded incorrect.
\end{question}

Example 3

\begin{question}{Formula}
\qutext{Compute $f'(2)$ if $f(x)=x^3+3\cos(x)-1$. Round your answer to
5 significant digits.}
\answer{9.2721}
% In this case, a more (or less) accurate response is graded incorrect.
\end{question}

Example 4

\begin{question}{Formula}
\qutext{Compute $f'(2)$ if $f(x)=x^3+3\cos(x)-1$. Your answer should be
correct to an accuracy of at least 5 decimal places.}
\answer{9.27211 ? 0.00001}
% Any response between 9.27210 and 09.27212 is graded correct.
% The response '12-3*sin(2)' is also acceptable.
\end{question}

Example 5

\begin{question}{Formula}
% This question uses randomized variables.
\qutext{Find the formula for the inverse of the function
$f(x)=\var{a}x+\var{b}$.}
\answer{(x-\var{b})/\var{a}}
\code{
$a=int(rint(9)+2);
$b=int(rint(9)+2);
}
% The above code chooses random integer coefficients a and b between
% 2 and 10.
\end{question}