OMD Documentation

omdSimplification

This module provides the core logic for simplifying mathematical expression trees within the OMD library. It defines functions for applying simplification rules, finding opportunities for simplification, and managing the simplification process.

Functions

simplifyExpression(rootNode)

Simplifies an entire mathematical expression tree by repeatedly applying simplification rules until no further simplifications are possible or a maximum iteration limit is reached. This function ensures that the resulting expression is in its most simplified form.

Notes:

simplifyStep(rootNode)

Applies a single simplification step to the expression tree. This function finds the first applicable simplification rule and applies it, returning the result.

Notes:

findSimplificationOpportunities(rootNode)

Traverses the expression tree (depth-first) to find all possible simplification opportunities. It identifies nodes where a simplification rule can be applied.

Notes:

getAvailableRulesForNode(node)

Debug Function: Lists all simplification rules that are potentially relevant to a given omdNode's type, regardless of whether they can currently be applied.

getApplicableRulesForNode(node)

Debug Function: Lists simplification rules that can actually be applied to a given omdNode based on its current structure and values.

Notes:

Integration with omdNode

This module also sets the simplifyStep function as the global simplification handler for omdNode instances. This allows any omdNode to call its simplify() method, which will internally use the simplifyStep function defined here.

See Also

↑ Top