Referencemath (Page 1)

<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>
AttributeTypeValues
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"
Props for <math name="m">
PropertyType
$m.anchorpoint
$m.backgroundColortext
$m.createIntervalsboolean
$m.createVectorsboolean
$m.disabledboolean
$m.displayBlanksboolean
$m.displayDecimalsinteger
$m.displayDigitsinteger
$m.displaySmallAsZeronumber
$m.draggableboolean
$m.expandboolean
$m.fixedboolean
$m.fixLocationboolean
$m.formattext
$m.functionSymbolstextList
$m.hiddenboolean
$m.isNumberboolean
$m.isNumericboolean
$m.latexlatex
$m.layernumber
$m.list[ math ]
$m.matrix[ math ]
$m.matrixSizenumberList
$m.numbernumber
$m.numColumnsinteger
$m.numDimensionsinteger
$m.numListItemsinteger
$m.numRowsinteger
$m.padZerosboolean
$m.parseScientificNotationboolean
$m.positionFromAnchortext
$m.renderModetext
$m.simplifytext
$m.splitSymbolsboolean
$m.texttext
$m.textColortext
$m.textStyleDescriptiontext
$m.unorderedboolean
$m.valuemath
$m.vector[ math ]
$m.xmath
$m.ymath
$m.zmath

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 sin(x)\sin(x) and log(x)\log(x) 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 log(x)\log(x) is ee. 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 Part 1 of the example.

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 Part 2, it is possible to input the desired expression 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:

  1. simplify="none": no simplification.
  2. simplify="full" (or simply simplify by itself): apply all available simplification routines.
    Does not include expanding factored expressions.
  3. simplify="numbers": simplify numerical expressions like 1+2 but not algebraic expressions.
    Permute terms and factors into a canonical order.
  4. 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 1,2,31,2,3 or tuples such as (1,2,3)(1,2,3).

An alternative way to specify that ordering doesn’t matter is with the unorderedCompare attribute of <answer>, <award>, <when>, or <boolean>.