Skip to Content
Referencesequence

<sequence>

Generates a sequence of numbers, math expressions, or letters

<sequence> is a Math component that generates a sequence of numbers, math expressions, or letters.

Attributes and Properties

Attributes for <sequence>

Highlighted (6)
asList

boolean. Default value: true. Whether to render the items separated by commas (true) or with no separator (false).

_componentWithSelectableType. The first value in the sequence.

integer. The number of values in the sequence.

math. The increment between successive values in the sequence.

_componentWithSelectableType. The last value in the sequence. Used together with from to determine length when length is not specified.

keyword. The kind of values in the sequence.

ValueDescription
numberA sequence of numeric values.
mathA sequence of math expressions (allows symbolic from/to/step).
lettersA sequence of letters (single-letter or multi-letter labels).
Number display (5)
avoidScientificNotationAdded in 0.7.16

boolean. Default value: false. Whether to render numbers in full decimal form rather than scientific notation.

displayDecimals

integer. Default value: 2. Number of decimal places to display when rendering this number.

displayDigits

integer. Default value: 3. Number of significant digits to display when rendering this number.

displaySmallAsZero

number. Default value: 1e-14. Threshold below which numbers are displayed as zero.

padZeros

boolean. Default value: false. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.

Other (1)

_componentListWithSelectableType. Values to exclude from the sequence.

Common to all components (9)
copy

reference. Create an independent copy of another component by reference. Enter a references a $name.

disabled

boolean. Default value: false. Whether this component is disabled and cannot be interacted with.

extend

reference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.

fixed

boolean. Default value: false. Whether this component's value is fixed and cannot be modified.

fixLocation

boolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

hide

boolean. Default value: false. Whether to hide this component from the rendered output.

isResponse

boolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.

name

text. The name used to reference this component from elsewhere in the document.

styleNumber

integer. Default value: 1. The style number used to select this component's visual styling from the available style definitions.

Properties for <sequence name="s">

Number display (5)
$s.avoidScientificNotationIn development

boolean. Whether to render numbers in full decimal form rather than scientific notation.

$s.displayDecimalsIn development

integer. Number of decimal places to display when rendering this number.

$s.displayDigitsIn development

integer. Number of significant digits to display when rendering this number.

$s.displaySmallAsZeroIn development

number. Threshold below which numbers are displayed as zero.

$s.padZerosIn development

boolean. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.

Common to all components (8)
$s.disabledIn development

boolean. Whether this component is disabled and cannot be interacted with.

$s.doenetML

text. The DoenetML source code that produced this component.

$s.fixedIn development

boolean. Whether this component's value is fixed and cannot be modified.

$s.fixLocationIn development

boolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

$s.hiddenIn development

boolean. Whether this component is hidden from the rendered output.

$s.hide

boolean. Whether to hide this component from the rendered output.

$s.isResponse

boolean. Whether this component is treated as a response for the purposes of assessment.

$s.styleNumber

integer. The style number used to select this component's visual styling from the available style definitions.

Examples

Example: Default <sequence>

The default <sequence> lists values from 11 to 1010 with step size 11.


Example: Using a <sequence> with a <repeat>

A <sequence> can be used to define the iteration for a <repeat>. Another way to accomplish this would be to use the <repeatForSequence> component.


Example: the sum of a <sequence>

In the sample code below, the sum of all values in a sequence is obtained by nesting the <sequence/> in a <sum> component. This technique works for multiple sequence as well.

Attribute Examples

Attribute Example: from, to

Use the from and to attributes to specify the endpoints of the <sequence>.


Attribute Example: step

Use the step attribute to specify the stepping increment for the <sequence>


Attribute Example: length

Use the length attribute to specify the number of terms in the <sequence>.


Attribute Example: exclude

The exclude attribute excludes terms from the <sequence>.


Attribute Example: type

The type attribute takes as an input either number or letters, and defaults to number.

Last updated on