<matrixInput/>
<matrixInput/> is an Input
component that renders an empty matrix with blanks for user-input of entries.
Attributes and Properties
Attributes for <matrixInput>
Number display (5)
avoidScientificNotationboolean. Default value: false. Whether to render numbers in full decimal form rather than scientific notation.
displayDecimalsinteger. Default value: 2. Number of decimal places to display when rendering this number.
displayDigitsinteger. Default value: 10. Number of significant digits to display when rendering this number.
displaySmallAsZeronumber. Default value: 0. Threshold below which numbers are displayed as zero.
padZerosboolean. Default value: false. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.
Labels (1)
labelIsNameboolean. Default value: false. Whether to use this component's name as its rendered label.
Other (14)
math. Two-way binding target for the input's value.
math. Default value: . Default value used for empty matrix cells.
forAnswerreference. References to <answer> elements that this input should submit to.
keyword. Input format for each cell.
| Value | Description |
|---|---|
text (default) | Plain-text math notation (e.g., x^2 + 1). |
latex | LaTeX-formatted math (e.g., x^{2} + 1). |
textList. Default value: ["f","g"]. Symbols treated as function names when parsing.
labelPositionkeyword. Position of the label relative to the input.
| Value | Description |
|---|---|
left (default) | Place the label to the left of the input. |
right | Place the label to the right of the input. |
integer. Default value: 0. Minimum rendered width for each cell, in pixels.
integer. Default value: 1. Number of columns in the matrix input.
integer. Default value: 1. Number of rows in the matrix input.
parseScientificNotationboolean. Default value: false. Whether to parse expressions like 1e3 as scientific notation.
math. Default value: . Initial matrix value displayed in the input.
boolean. Default value: true. Whether to render controls for resizing the matrix.
boolean. Default value: true. Whether multi-character symbols are split into a product of variables.
unionFromUboolean. Default value: false. Whether "U" between sets is parsed as union.
Common to all components (9)
copyreference. Create an independent copy of another component by reference. Enter a references a $name.
disabledboolean. Default value: false. Whether this component is disabled and cannot be interacted with.
extendreference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.
fixedboolean. Default value: false. Whether this component's value is fixed and cannot be modified.
fixLocationboolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
hideboolean. Default value: false. Whether to hide this component from the rendered output.
isResponseboolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.
nametext. The name used to reference this component from elsewhere in the document.
styleNumberinteger. Default value: 1. The style number used to select this component's visual styling from the available style definitions.
Properties for <matrixInput name="m">
Number display (5)
$m.avoidScientificNotationboolean. Whether to render numbers in full decimal form rather than scientific notation.
$m.displayDecimalsinteger. Number of decimal places to display when rendering this number.
$m.displayDigitsinteger. Number of significant digits to display when rendering this number.
$m.displaySmallAsZeronumber. Threshold below which numbers are displayed as zero.
$m.padZerosboolean. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.
Labels (2)
$m.labellabel. The label rendered with this component.
$m.labelIsNameboolean. Whether to use this component's name as its rendered label.
Other (24)
$m.columns[ math ]. The matrix's entries grouped by column.
$m.disabledboolean. Whether this component is disabled and cannot be interacted with.
$m.fixedboolean. Whether this component's value is fixed and cannot be modified.
$m.fixLocationboolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
$m.focusedboolean. Whether the matrix input currently has keyboard focus.
$m.formattext. Input format for each cell.
$m.functionSymbolstextList. Symbols treated as function names when parsing.
math. The current matrix being entered (live, before saving).
boolean. Whether the live matrix differs from its initial state.
$m.labelPositiontext. Position of the label relative to the input.
$m.matrix[ math ]. The matrix as a math expression.
$m.numColumnsinteger. The number of columns of the matrix.
$m.numRowsinteger. The number of rows of the matrix.
$m.parseScientificNotationboolean. Whether to parse expressions like 1e3 as scientific notation.
$m.prefillmath. Initial matrix value displayed in the input.
$m.rows[ math ]. The matrix's entries grouped by row.
$m.shortDescriptiontext. A short accessibility description of this input; it is visible to screen readers but not rendered visually.
$m.showSizeControlsboolean. Whether to render controls for resizing the matrix.
$m.splitSymbolsboolean. Whether multi-character symbols are split into a product of variables.
$m.texttext. The current matrix as a text string.
$m.unionFromUboolean. Whether "U" between sets is parsed as union.
$m.valuemath. The most recently saved matrix value.
$m.valueChangedboolean. Whether the saved matrix has been changed from its initial state.
Common to all components (4)
$m.doenetMLtext. The DoenetML source code that produced this component.
$m.hideboolean. Whether to hide this component from the rendered output.
$m.isResponseboolean. Whether this component is treated as a response for the purposes of assessment.
$m.styleNumberinteger. The style number used to select this component's visual styling from the available style definitions.
Examples
Example: Default <matrixInput/>
The default <matrixInput/> contains a single input blank. Additional
rows and columns are added with rendered size control buttons.
Example: A blank 2x3 <matrixInput/>
To show a <matrixInput/> of a specific, unchangeable size,
use the numRows and the numColumns attributes. Set the showSizeControls
attribute to false to prevent the user from altering the size.
Example: Retrieving an entry from a <matrixInput/>
Individual entries of the matrix can be accessed using array
notation with the matrix property.
Example: Operations with <matrixInput/> - defined matrices
Basic matrix operations can be performed with named <matrixInput/> components. See
the <matrix> component for additional examples.
Example: Prefill a <matrixInput/> with a <matrix>
To easily prefill a <matrixInput/> with specific entries, first
define a <matrix> and reference it by name within the prefill attribute
of the <matrixInput/>.
Attribute Examples
Attribute Example: numRows / numColumns
A <matrixInput/> of a specific size can be initialized with the numRows and the numColumns attributes.
Attribute Example: showSizeControls
The default size control buttons can be hidden by setting the showSizeControls attribute to false.
Attribute Example: prefill
To easily prefill a <matrixInput/> with specific entries, first define a <matrix> and reference it by name within the prefill attribute of the <matrixInput/>.
Attribute Example: defaultEntry
Use the defaultEntry attribute to change the prefilled value for a matrix of a specified size; the default value is an empty input box.
Attribute Example: format
The format attribute gives the option for prefilled <matrixInput/> components to contain content formatted in LaTeX. If supported, expressions entered in the prefill of the <matrixInput/> will be parsed by Doenet as math components and may be used in further computations.
Attribute Example: functionSymbols
The functionSymbols attribute is used to specify when a character is formatted as a function that takes an argument in parentheses. Default = “f”, “g”; type = textList
Try deleting the specification functionSymbols="f g h" from the example above to observe the difference in the simplification of .
Attribute Example: splitSymbols
The splitSymbols attribute is used to modify the default mathematical simplification of multicharacter values in a <mathInput/> (think of each entry in a <matrixInput/> as a <mathInput/>). By default, Doenet assumes adjacent characters are single variables multiplied together, and “splits” them during parsing. So, for example, multicharacter values such as xyz are interpreted as the product . However, if you wish to treat a grouping of symbols as a single variable, you can turn off this behavior by specifying splitSymbols="false".
Attribute Example: bindValueTo
The bindValueTo attribute is used to create a bidirectional link between the value of a <matrixInput/> and that of another component. This attribute accepts a reference to a named math component or the property of a named component as input.
Attribute Example: minComponentWidth
The minComponentWidth attribute adjusts the width of the individual <mathInput/> components within the <matrixInput/>.
Property Examples
Property Example: Attributes as properties
The attributes shown above are also accessible as properties.
Property Example: valueChanged / immediateValueChanged
The valueChanged property returns the boolean value of whether the <matrixInput/> has been changed by the user when the page is updated (which occurs when the user clicks elsewhere, hits Enter, or interacts with another part of the page).
The immediateValueChanged property returns the boolean value of whether the <matrixInput/> has been changed by the user immediately as they are typing into the input.
Property Example: value / immediateValue
The value property returns the value stored in the <matrixInput/> since the most current page update (which occurs when the user clicks elsewhere, hits Enter, or interacts with another part of the page).
The immediateValue property returns the value stored in the <matrixInput/>, updated immediately as the user is typing it in.