Matrix input and grading
A matrix question can ask for one particular matrix, any basis of a space, or any matrix with a stated property. Choose the mathematical test first; the editor collects entries, while the answer test and response tree decide correctness and marks. Try the matrix questions before adapting one.
For teachers
What learners see
A learner fills matrix cells, presses Validate answers to inspect the interpreted matrix, then presses Check answer. Empty cells are invalid. The editor retains typed forms such as x+x or 1/2; resizing keeps cells that still fit and leaves new cells blank. Editing, resizing, resetting or switching variants clears an earlier result and requires validation again. After a basis check, vector colors explain membership and dependence, but the response tree still determines the score.
For developers
XML input and learner-selected dimensions
Use <input><type>matrix</type>... for a fixed-size matrix; the input model answer supplies its dimensions. For learner-selected columns, as in the basis examples, add:
<matrix>
<rows initial="3" min="3" max="3" resizable="0"/>
<cols initial="1" min="1" max="3" resizable="1"/>
</matrix>Each axis requires initial, min, max and resizable. A fixed axis uses resizable="0" with equal initial, minimum and maximum. The product of the two maxima may not exceed 64. This sizing element is a CTM STACK extension and needs adaptation for native Moodle STACK. The input model and authored tests must fit the configured dimensions. For a matrix-defined space, the input model can use nullspace_basis(A), columnspace_basis(A) or rowspace_basis(A) while the PRT uses the original A.
Supported values and tests
Author expressions write a matrix as matrix([a,b],[c,d]), distinct from a nested list. Matrices must be rectangular and complete, with 1–16 rows and columns and at most 64 scalar entries. Cells cannot contain collections, equations or logical values. The supported native STACK matrix tests here are AlgEquiv, SameType and EqualComAss; other native matrix tests and general matrix arithmetic are outside this port’s current support.
Raw cells remain unchanged until validation interprets them. The editor does not create zeros for blank cells or compute marks. The reusable component and its provenance are recorded in the project source tree; question authors configure it through XML.