ReferencematrixInput

<matrixInput/>

<matrixInput/> is an Input component renders an empty matrix with blanks for user-input of entries.

Attributes and Properties

Attributes for <matrixInput>
AttributeTypeValues
bindValueTo = "…"
defaultEntry = "…"
displayDecimals = "…"integer
displayDigits = "…"integer
displaySmallAsZero = "…"number
format = "…"text"text" "latex"
functionSymbols = "…"textList
minComponentWidth = "…"
numColumns = "…"integer
numRows = "…"integer
padZeros = "…"boolean"true" "false"
parseScientificNotation = "…"boolean"true" "false"
prefill = "…"math
showSizeControls = "…"boolean"true" "false"
splitSymbols = "…"boolean"true" "false"
unionFromU = "…"boolean"true" "false"
Props for <matrixInput name="m">
PropertyType
$m.collaborateGroupscollaborateGroups
$m.disabledboolean
$m.displayDecimalsinteger
$m.displayDigitsinteger
$m.displaySmallAsZeronumber
$m.fixedboolean
$m.fixLocationboolean
$m.formattext
$m.functionSymbolstextList
$m.hiddenboolean
$m.immediateValuemath
$m.immediateValueChangedboolean
$m.matrix[ math ]
$m.numColumnsinteger
$m.numRowsinteger
$m.padZerosboolean
$m.parseScientificNotationboolean
$m.prefillmath
$m.showSizeControlsboolean
$m.splitSymbolsboolean
$m.texttext
$m.unionFromUboolean
$m.valuemath
$m.valueChangedboolean

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 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 A2A^2.


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 xyzx \cdot y \cdot z. 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 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.