<matrix>
<matrix> is a Math
component that defines/renders a matrix for use in computations.
Attributes and Properties
Attributes for <matrix>
Highlighted (3)
displayDigitsinteger. Default value: 3. Number of significant digits to display when rendering this number.
formatkeyword. Input format.
| Value | Description |
|---|---|
text (default) | Plain-text math notation (e.g., x^2 + 1). |
latex | LaTeX-formatted math (e.g., x^{2} + 1). |
simplifykeyword. Level of simplification applied to the expression.
| Value | Description |
|---|---|
none (default) | No simplification is applied. |
full | Fully simplify the expression. |
numbers | Simplify numeric subexpressions only, leaving symbolic structure intact. |
numbersPreserveOrder | Like numbers, but does not reorder commutative operands. |
normalizeOrder | Reorder commutative operands into a canonical form without simplifying values. |
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: 3. Number of significant digits to display when rendering this number.
displaySmallAsZeronumber. Default value: 1e-14. 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.
Positioning (2)
anchorpoint. Default value: . Coordinates of the anchor point used to position this component on a graph.
positionFromAnchorkeyword. Where this component sits relative to its anchor point.
| Value | Description |
|---|---|
upperRight | Place the component above and to the right of the anchor point. |
upperLeft | Place the component above and to the left of the anchor point. |
lowerRight | Place the component below and to the right of the anchor point. |
lowerLeft | Place the component below and to the left of the anchor point. |
top | Place the component directly above the anchor point. |
bottom | Place the component directly below the anchor point. |
left | Place the component directly to the left of the anchor point. |
right | Place the component directly to the right of the anchor point. |
center (default) | Center the component on the anchor point. |
Other (16)
assumptionsmath. Default value: . Assumptions applied when simplifying or comparing.
createIntervalsboolean. Default value: false. Whether range expressions are interpreted as intervals.
createVectorsboolean. Default value: false. Whether tuple-like expressions are interpreted as vectors.
math. Default value: . Value used for entries that aren't explicitly specified.
displayBlanksboolean. Default value: true. Whether blanks (placeholders) are visibly rendered.
draggableboolean. Default value: true. Whether the math component can be dragged on a graph.
expandboolean. Default value: false. Whether to expand the expression.
functionSymbolstextList. Default value: ["f","g"]. Symbols treated as function names when parsing.
layernumber. Default value: 0. Z-order layer index when shown on a graph.
integer. Number of columns in the matrix.
integer. Number of rows in the matrix.
parseScientificNotationboolean. Default value: false. Whether to parse expressions like 1e3 as scientific notation.
referencesAreFunctionSymbolsreference. References whose names should be treated as function symbols when parsing.
renderModetext. Default value: inline. How the math is rendered (e.g. "inline", "display").
splitSymbolsboolean. Default value: true. Whether multi-character symbols are split into a product of variables.
unorderedboolean. Whether tuple- or list-like math expressions should be treated as unordered for comparison.
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 <matrix name="m">
Highlighted (3)
$m.displayDigitsinteger. Number of significant digits to display when rendering this number.
$m.formattext. Input format.
$m.simplifytext. Level of simplification applied to the expression.
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.
Positioning (2)
$m.anchorpoint. The coordinates where this component is anchored on the graph.
$m.positionFromAnchortext. Where this component sits relative to its anchor point.
Other (38)
$m.assumptionsmath. Assumptions applied when simplifying or comparing.
$m.backgroundColortext. Human-readable name for this component's background color, derived from the active style and theme.
$m.columns[ math ]. The matrix's entries grouped by column.
$m.createIntervalsboolean. Whether range expressions are interpreted as intervals.
$m.createVectorsboolean. Whether tuple-like expressions are interpreted as vectors.
$m.disabledboolean. Whether this component is disabled and cannot be interacted with.
$m.displayBlanksboolean. Whether blanks (placeholders) are visibly rendered.
$m.draggableboolean. Whether the math component can be dragged on a graph.
$m.expandboolean. Whether to expand the expression.
$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.functionSymbolstextList. Symbols treated as function names when parsing.
$m.isNumberboolean. Whether the expression evaluates to a finite number.
$m.isNumericboolean. Whether the expression evaluates to any number (including infinities).
$m.latexlatex. The expression rendered as a LaTeX string.
$m.layernumber. Z-order layer index when shown on a graph.
$m.list[ math ]. The math expression interpreted as a list (its elements).
$m.matrix[ math ]. The math expression interpreted as a matrix (its entries by row and column).
$m.matrixSizenumberList. The size of the math expression as a matrix, as a [numRows, numColumns] list.
$m.numbernumber. The numeric value of the expression (NaN if not a number).
$m.numColumnsinteger. The number of columns when the math expression is interpreted as a matrix.
$m.numDimensionsinteger. The number of dimensions if the math expression is interpreted as a vector or matrix.
$m.numListItemsinteger. The number of items when the math expression is interpreted as a list.
$m.numRowsinteger. The number of rows when the math expression is interpreted as a matrix.
$m.parseScientificNotationboolean. Whether to parse expressions like 1e3 as scientific notation.
$m.renderModetext. How the math is rendered (e.g. "inline", "display").
$m.rows[ math ]. The matrix's entries grouped by row.
$m.splitSymbolsboolean. Whether multi-character symbols are split into a product of variables.
$m.texttext. The expression rendered as a plain text string.
$m.textColortext. Human-readable name for this component's text color, derived from the active style and theme.
$m.textStyleDescriptiontext. Human-readable description of this component's text styling (color and any background color).
$m.unorderedboolean. Whether matrix entries should be treated as unordered.
$m.valuematrix. The math expression value.
$m.vector[ math ]. The math expression interpreted as a vector (its components).
$m.xmath. The first component of the math expression when interpreted as a vector.
$m.ymath. The second component of the math expression when interpreted as a vector.
$m.zmath. The third component of the math expression when interpreted as a vector.
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: Create a <matrix> from rows
Matrices can be quickly defined by listing row entries within nested <row> components.
Individual entries can be accessed using array notation with the matrix property.
Example: Create a <matrix> from columns
Matrices can be quickly defined by listing column entries within nested <column> components. Individual
entries can be accessed using array notation with the matrix property.
Example: Create a <matrix> of a given size
A <matrix> of a given size can be generated using the numRows and the numColumns attributes. By
default, a zero matrix will be defined; to modify this use the defaultEntry attribute.
Example: Create a <matrix> from user-input rows
This example shows one method of populating the entries of a <matrix> from user-input. See
also, <matrixInput>.
Example: <matrix> addition/ subtraction
The <math> component with the simplify attribute performs matrix addition and subtraction.
Example: <matrix> multiplication
The <math> component, along with both the simplify and expand attributes,
performs matrix multiplication.
Example: Multiplication by a scalar
The <math> component with the simplify attribute performs matrix multiplication by a scalar.
Example: <matrix> from geometry
A coefficient matrix can be constructed from vectors or other
geometric objects by referencing the objects within the <row> or <column>
components. The references should be enclosed in parentheses.
Attribute Examples
Attribute Example: numRows / numColumns
With numRows and numColumns, a zero matrix of a given size can be defined.
Attribute Example: defaultEntry
Use the defaultEntry attribute to change the prefilled value for a matrix
of a specified size; the default value is .
Property Examples
Property Example: Attributes as properties
The numRows attribute is also accesible as a property.