<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
Attribute | Type | Values |
---|---|---|
anchor = "…" | point | |
createIntervals = "…" | boolean | "true" "false" |
createVectors = "…" | boolean | "true" "false" |
displayBlanks = "…" | boolean | "true" "false" |
displayDecimals = "…" | integer | |
displayDigits = "…" | integer | |
displaySmallAsZero = "…" | number | |
draggable = "…" | boolean | "true" "false" |
expand = "…" | boolean | "true" "false" |
format = "…" | text | "text" "latex" |
functionSymbols = "…" | textList | |
layer = "…" | number | |
padZeros = "…" | boolean | "true" "false" |
parseScientificNotation = "…" | boolean | "true" "false" |
positionFromAnchor = "…" | text | "upperright" "upperleft" "lowerright" "lowerleft" "top" "bottom" "left" "right" "center" |
referencesAreFunctionSymbols = "…" | ||
renderMode = "…" | text | |
simplify = "…" | text | "none" "full" "numbers" "numberspreserveorder" |
splitSymbols = "…" | boolean | "true" "false" |
unordered = "…" | boolean | "true" "false" |
Property | Type |
---|---|
$m.anchor | point |
$m.backgroundColor | text |
$m.createIntervals | boolean |
$m.createVectors | boolean |
$m.disabled | boolean |
$m.displayBlanks | boolean |
$m.displayDecimals | integer |
$m.displayDigits | integer |
$m.displaySmallAsZero | number |
$m.draggable | boolean |
$m.expand | boolean |
$m.fixed | boolean |
$m.fixLocation | boolean |
$m.format | text |
$m.functionSymbols | textList |
$m.hidden | boolean |
$m.isNumber | boolean |
$m.isNumeric | boolean |
$m.latex | latex |
$m.layer | number |
$m.list | [ math ] |
$m.matrix | [ math ] |
$m.matrixSize | numberList |
$m.number | number |
$m.numColumns | integer |
$m.numDimensions | integer |
$m.numListItems | integer |
$m.numRows | integer |
$m.padZeros | boolean |
$m.parseScientificNotation | boolean |
$m.positionFromAnchor | text |
$m.renderMode | text |
$m.simplify | text |
$m.splitSymbols | boolean |
$m.text | text |
$m.textColor | text |
$m.textStyleDescription | text |
$m.unordered | boolean |
$m.value | math |
$m.vector | [ math ] |
$m.x | math |
$m.y | math |
$m.z | math |
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 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 four options:
simplify="none"
: no simplification.simplify="full"
(or simplysimplify
by itself): apply all available simplification routines.
Does not include expanding factored expressions.simplify="numbers"
: simplify numerical expressions like1+2
but not algebraic expressions.
Permute terms and factors into a canonical order.simplify="numbersPreserveOrder"
: simplify numbers but without permuting terms or factors.
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: 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>
.