ReferencemathList

<mathList>

<mathList> is a Math component that defines a collection, or list, of <math> components. Some components that accept a <mathList> as an input include functions, repeats, and awards.

Attributes and Properties

Attributes for <mathList>
AttributeTypeValues
asList = "…""true" "false"
displayDecimals = "…"
displayDigits = "…"
displaySmallAsZero = "…"
functionSymbols = "…"textList
maxNumber = "…"number
mergeMathLists = "…"boolean"true" "false"
padZeros = "…"
parseScientificNotation = "…"boolean"true" "false"
referencesAreFunctionSymbols = "…"
splitSymbols = "…"boolean"true" "false"
unordered = "…"boolean"true" "false"
Props for <mathList name="m">
PropertyType
$m.functionSymbolstextList
$m.maxNumbernumber
$m.mergeMathListsboolean
$m.numComponentsnumber
$m.numValuesnumber
$m.parseScientificNotationboolean
$m.splitSymbolsboolean
$m.unorderedboolean

Example: Defining a <mathList> and retrieving a value

The <mathList> component stores a list of “maths”, or <math> components. To access an individual element in the list, use array notation with the named <mathList>.


Example: A <mathList> from multiple <mathInput/> tags

Combining a number of user-inputs into a <mathList> is a simple matter of listing the named input references between the opening and closing tags.


Example: A <mathList> for function evaluation

Here, a <mathList> stores multiple input values to be used in the subsequent code for function evaluation.


Example: A <mathList> in a <repeat>

Here, a <mathList> is referenced within the for attribute of a <repeat>.


Example: A <mathList> in an <award>

A <mathList> is frequently used in an <award> to compare two groups of values. Comparisons can be ordered or unordered. (Also, specifying whether comparisons are to be ordered can occur in the <award>, the <answer>, or the <mathList> itself.)


Attribute Example: unordered

If a <mathList> is defined with the unordered attribute, comparisons (for validation in an <award> or a <boolean> for example) are unordered automatically.


Attribute Example: maxNumber

The maxNumber attribute imposes a limit on the number of maths that can be stored in the list.


Attribute Example: mergeMathLists

If individual maths contained within a <mathList> contain multiple values, those groupings will be preserved by default. To turn off this default behavior, use the mergeMathLists attribute.


Attribute Example: Attributes as properties

All of the attributes of the <mathList> component are also available as properties.


Property Example: numComponents

The numComponents property returns the number of components stored in a <mathList>. Note that the first math listed in the definition in the example above counts as one component, even when lists are merged, because it is specified as a tuple (enclosed by parentheses). The second math in the definition counts as 1 component when lists are not merged, and 3 components if they are merged.


Property Example: latex

The latex property returns the LaTeX code required to render the maths in an array. The LaTeX code for individual components can be accessed using array notation and then appending the latex property.


Property Example: text

The text property returns the maths in text format in an array. The text for individual components can be accessed using array notation and then appending the text property.