# Example¶

If the solution to a question is a row vector, a columne vector or a matrix, the generic problem is of the type input.matrix.

You can define a matrix within the variables environment using the following syntax:

\matrix[&lt;options&gt;]{&lt;variable&gt;}{&lt;entries&gt;}Within the &lt;entries&gt; you can use & to to start a new matrix column and use \\ to start a new matrix row.Entries can be:numbersfunctionsother variablesThe \matrix takes the same &lt;options&gt; as a function, that is calculate, normalize, expand, and sort.

Finally, one can specify a \format{<row_count>}{<col_count>} within the answer environment.
When specifying this format an empty matrix will be displayed with the given row and col count as format and it's dimension can not be changed by the user.
When -1 is used as either the row or column count, then the user has te determine this property himself.
When no \format is specified, the must specify both the row and column count himself.
Example:

\begin{problem}

%% QUESTION 1 %%  \begin{question}
\type{input.matrix}
\begin{variables}                  % Row vector (1x4)      \number{a}{1/3}      \number{b}{1/7}      \matrix[calculate]{v_r}{a +1 & 1 & 3 & b}
% Column vector (4x1)          \matrix[calculate]{v_c}{3^2/7 \\ x \\ 10 \\ 0}    \end{variables}
\displayprecision{4}    \correctorprecision{3}    \field{real}
\text{      \textbf{Question 1}\\      Determine the decimal expansion of the entries in\\      $\var{v_r}$ and \\      $\var{v_c}$ \\      rounded to three decimal places.}      \explanation{Think about what rounded off to three decimal places means.}    }
\begin{answer}      \text{Answer: }       \solution{v_r}      \format{1}{-1}    \end{answer}
\begin{answer}      \text{Answer: }      \solution{v_c}      \format{-1}{1}    \end{answer}  \end{question}
%% QUESTION 2 %%  \begin{question}
\type{input.matrix}    \displayprecision{4}    \correctorprecision{2}    \field{real}
\begin{variables}      \matrix{m}{        3/7 & x^2 & 0 \\          5   & 2   & 3       } % 3/7 is shown as a fraction
\matrix[calculate]{m_1}{        3/7 & x^2 & 0 \\         5   & 2   & 3       }  %3/7 is shown as a decimal rounded to displayprecision    \end{variables}
\text{      \textbf{Question 2}\\      Determine the decimal expansion of the entries in $\var{m}$ rounded to two decimal places.}      \explanation{Think about what rounded off to three decimal places means.}    }
\begin{answer}      \text{Answer: }      \solution{m_1}     \end{answer}
\end{question}

\end{problem}

\embedapplet{applet}

Add picture from clipboard (Maximum size: 500 MB)