OMD Documentation

omdEquationSequenceNode

Represents a sequence of mathematical steps, typically a series of equations that show the process of solving a problem. This node is a container that manages the layout, alignment, and simplification history of its steps.

Class: omdEquationSequenceNode extends omdNode

import { omdEquationSequenceNode } from './omd/nodes/omdEquationSequenceNode.js';

Constructor

new omdEquationSequenceNode(steps)

Parameters:

Static Methods

fromSteps(stepsArray)

Creates an omdEquationSequenceNode from an array of expression strings.

const sequence = omdEquationSequenceNode.fromSteps([
    '2x + 4 = 10',
    '2x = 6',
    'x = 3'
]);

Core Methods

addStep(step, options)

Adds a new step to the end of the sequence.


simplify()

Applies one round of simplification to the last step in the sequence and adds the result as a new step.


simplifyAll(maxIterations)

Repeatedly calls simplify() on the last step until no more simplifications can be applied or the iteration limit is reached.


applyEquationOperation(value, operation)

Applies an operation (e.g., 'add', 'subtract', 'multiply', 'divide') to both sides of the last equation in the sequence. This typically adds two new steps: a visual display of the operation and the resulting new equation.


applyEquationFunction(functionName)

Applies a function (e.g., 'sqrt') to both sides of the last equation and adds the result as a new step.

Other Key Methods

Layout and Provenance

The omdEquationSequenceNode automatically aligns all omdEquationNode steps by their equals signs, creating a clean, readable layout. It also tracks provenance for all nodes, supporting step-by-step highlighting and history.

Example

// Create a sequence with an initial equation
const sequence = omdEquationSequenceNode.fromSteps([
  '2 * (x + 1) = 10'
]);

// Apply operations and simplifications
sequence.applyEquationOperation(2, 'divide'); // Adds a step: (2*(x+1))/2 = 10/2
sequence.simplifyAll(); // Simplifies to x+1=5, then x=4

// Add the sequence to a display
const display = new omdDisplay(document.getElementById('container'));
display.render(sequence);

See Also

↑ Top