Description
This question type lays out an
n ×
m matrix of text fields,
each of which accepts a number or formula.
Notes
- The given correct answer must be presented
as a comma-separated list with the first row listed first,
then the second row, etc.
- The required
\size
macro gives the size of the answer
matrix. The format is \size{m}{n}
, where m
is the number of rows, and n
is the number of columns.
Examples
\begin{question}{Matrix}
\qutext{Find the transpose of the matrix
$$A=\left[\begin{array}{ccc} 1 & 2 & 3\\ 0 & 1 & -2\end{array}\right]$$}
% Give the number of rows of the answer first, then the number of
columns:
\size{3}{2}
% Use a comma-separated list, starting with the first row:
\answer{1, 0,
2, 1,
3, -2}
% Introducing some formatting in the answer as above will make it easier
% for the author to read, but it is not necessary.
\end{question}
\begin{question}{Matrix}
% This question uses algorithmic variables.
\qutext{Find the transpose of the matrix
$$A=\left[\begin{array}{ccc} \var{a} & \var{b} & \var{c}\\
\var{d} & \var{e} & \var{f}\end{array}\right]$$}
\size{3}{2}
\answer{\var{a}, \var{d},
\var{b}, \var{e},
\var{c}, \var{f}}
\code{$a = range(-9,9);
$b = range(-9,9);
$c = range(-9,9);
$d = range(-9,9);
$e = range(-9,9);
$f = range(-9,9);}
% The above code chooses six random integer coefficients a, b, c, d, e,
% and f, between -9 and 9.
\end{question}