<math>
<math> is a Math
component that defines a symbolic or numerical math expression that can be rendered and used in computations.
Attributes and Properties
Attributes for <math>
Highlighted (3)
integer. Default value: 3. Number of significant digits to display when rendering this number.
keyword. 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.
integer. Default value: 2. Number of decimal places to display when rendering this number.
integer. Default value: 3. Number of significant digits to display when rendering this number.
number. Default value: 1e-14. Threshold below which numbers are displayed as zero.
boolean. 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 (13)
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.
boolean. Default value: true. Whether blanks (placeholders) are visibly rendered.
draggableboolean. Default value: true. Whether the math component can be dragged on a graph.
boolean. Default value: false. Whether to expand the expression.
textList. Default value: ["f","g"]. Symbols treated as function names when parsing.
layernumber. Default value: 0. Z-order layer index when shown on a graph.
parseScientificNotationboolean. Default value: false. Whether to parse expressions like 1e3 as scientific notation.
reference. References whose names should be treated as function symbols when parsing.
renderModetext. Default value: inline. How the math is rendered (e.g. "inline", "display").
boolean. Default value: true. Whether multi-character symbols are split into a product of variables.
boolean. Default value: false. 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 <math 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.
integer. 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 list-like values are treated as unordered.
$m.valuemath. 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 Page 1
Example: Named <math> for computations
The <math> component can be used to name and store symbolic math expressions for computations.
Example: How spaces are interpreted in a <math>
Spaces between terms in a <math> component are interpreted as multiplication.
Example: Some common <math> functions and their syntax
Many mathematical functions such as and are interpreted by
Doenet when nested within a <math> component. In this example, several built-in <math> functions
that Doenet will simplify are illustrated with their syntax. Note that the default base when
using is . For a complete updated listing of supported functions,
see the DoenetML Manual.
Attribute Examples
Attribute Example: format
The format attribute specifies how the enclosed math expression is entered, and
accepts inputs of either latex or text. The default value for this attribute is text,
which corresponds to the syntax that you would naturally type in a typical online calculator.
This is illustrated in
If the format is set to latex, the input text can be written in
LaTeX and Doenet will interpret and translate this into functional mathematical code.
Therefore, as shown in latex format and then evaluate it with the simplify attribute.
Attribute Example: simplify = “full” (or just simplify)
The first <math> component defines an unsimplified expression,
while the second <math> component references the first expression by name,
adds two additional terms, and simplifies the resulting expression.
The simplify attribute has five options:
simplify="none": no simplification.simplify="full"(or simplysimplifyby itself): apply all available simplification routines.
Does not include expanding factored expressions.simplify="numbers": simplify numerical expressions like1+2but not algebraic expressions.
Permute terms and factors into a canonical order.simplify="numbersPreserveOrder": simplify numbers but without permuting terms or factors.simplify="normalizeOrder": permute terms and factors to a standard order but perform no other simplifications.
To include expansion of factored expressions, you can add the expand attribute.
If the simplify attribute is not specified within the <math> component,
no simplification occurs (i.e. this is equivalent to specifying simplify="none").
Attribute Example: simplify = “numbers”
When only numerical terms are to be combined, use the simplify="numbers"
specification inside the <math> component. Some rearrangement of terms
may occur during simplification.
Attribute Example: simplify = “numbersPreserveOrder”
When only numerical terms are to be combined and terms must
remain in their original ordering, use the simplify="numbersPreserveOrder" specification
inside the <math> component.
Attribute Example: simplify = “normalizeOrder”
To make all terms and factors appear in a standardized order without any further simplifications, use the simplify="normalizeOrder" specification
inside the <math> component.
Attribute Example: expand
By default, a <math> will not expand factored expressions.
Specifying the expand attribute will expand the result.
Attribute Example: unordered
The unordered attribute determines how the whether or not comparisons with the <math>
require the same order of its subparts. The first <math> is defined without
the unordered attribute, so it defaults to unordered="false". The second <math>
has unordered="true" specified, so it will match expressions independent of the ordering.
The unordered affects both lists, suchs or tuples such as .
An alternative way to specify that ordering doesn’t matter is
with the unorderedCompare attribute of <answer>, <award>, <when>, or <boolean>.