Skip to content

Matrices

Input fields for matrices can be created using the input type matrix in the input element.

The cells of a matrix must consist either completely of numbers or completely of expressions. It is forbidden to mix these two input types in one matrix.

Example

<p>
    Enter the identity matrix of size <m>2 \times 2</m>:
</p>
<p>
    Answer: <input>
        <matrix>
            <matrixrow>
                <number>1</number>
                <number>0</number>
            </matrixrow>
            <matrixrow>
                <number>0</number>
                <number>1</number>
            </matrixrow>
        </matrix>
    </input>
</p>

Attributes

The matrix element supports the following attributes:

Attribute Type Default Description
credits xs:nonNegativeInteger 1 Number of credit points the user gets awarded for this input value.
defaultcolumns xs:positiveInteger | Auto - Initial number of columns in this matrix that are already there when the user loads the page. When this attribute is set to auto, the matrix initially has as many columns as the first matrix written as solution in this input value element.
defaultrows xs:positiveInteger | Auto - Initial number of rows in this matrix that are already there when the user loads the page. When this attribute is set to auto, the matrix initially has as many rows as the first matrix written as solution in this input value element.
maxcolumns xs:positiveInteger | Unbounded - Maximum number of columns that the user is allowed to put in the matrix.
maxrows xs:positiveInteger | Unbounded - Maximum number of rows that the user is allowed to put in the matrix.
mincolumns xs:positiveInteger - Minimum number of columns that the user is allowed to put in the matrix.
minrows xs:positiveInteger - Minimum number of rows that the user is allowed to put in the matrix.
model xs:Name - Name of the model to use for this input value. If this attribute is not set, the input model associated to the input field containing this input value is used.

The matrixrow element supports no attributes.