Elements
Class ExprElement
Maths Expression
Accessor .unknowns
Returns a list of all variables used in the expression (excluding defined constants).
Accessor .variables
Returns a list of all variables used in the expression (including defined constants).
Method .evaluate (_vars: VarMap, _privateNested: boolean): number
Evaluates an expression using a given map of variables and functions.
Name | Type | Default | Description |
---|---|---|---|
_vars | VarMap | … | |
_privateNested | boolean |
Method .interval (vars: VarMap, _privateNested: boolean): Interval
Name | Type | Default | Description |
---|---|---|---|
vars | VarMap | … | |
_privateNested | boolean |
Method .recursiveSubstitute (vars: ExprMap): ExprElement
Recursively substitutes a new expression for a variable. NOTE: This function does not test for cyclical dependencies, which could lead to an infinite loop. You have to manually validate expressions first!
Name | Type | Default | Description |
---|---|---|---|
vars | ExprMap |
Method .substitute (_vars: ExprMap): ExprElement
Substitutes a new expression for a variable.
Name | Type | Default | Description |
---|---|---|---|
_vars | ExprMap | … |
Method .toMathML (_custom: MathMLMap): string
Converts the expression to a MathML string.
Name | Type | Default | Description |
---|---|---|---|
_custom | MathMLMap | … |
Class ExprIdentifier
Extends ExprElement
Method .evaluate (vars: VarMap, privateNested: boolean): number
Name | Type | Default | Description |
---|---|---|---|
vars | VarMap | … | |
privateNested | boolean |
Method .interval (vars: VarMap, privateNested: boolean): Interval
Name | Type | Default | Description |
---|---|---|---|
vars | VarMap | … | |
privateNested | boolean |
Class ExprNumber
Extends ExprElement
Class ExprOperator
Extends ExprElement
Class ExprString
Extends ExprElement
Method .evaluate (vars: VarMap, privateNested: boolean): number
Name | Type | Default | Description |
---|---|---|---|
vars | VarMap | … | |
privateNested | boolean |