-
MathType
-
WirisQuizzes
-
Nubric
-
CalcMe
-
MathPlayer
-
Store FAQ
-
MathFlow
-
BF FAQ
-
Miscellaneous
-
Wiris Integrations
Expression evaluation
Reading time: 1minReference describing the MathType expression evaluation engine and its capabilities.
Summary
MathType includes a mathematical expression evaluation engine that computes the numerical value of expressions represented as MathML. The evaluation engine is intended for numerical calculations. It is not a Computer Algebra System (CAS) and does not perform symbolic manipulation.
Expression evaluation relies on Content MathML. When a Presentation MathML expression is evaluated, MathType first converts it into Content MathML before traversing the resulting semantic expression tree.
Supported behaviour
| Feature | Supported | Notes |
|---|---|---|
| Numerical evaluation | ✓ | Evaluates well-formed mathematical expressions. |
| Variable substitution | ✓ | Variable values can be supplied before evaluation. |
| Syntax validation | ✓ | Invalid expressions can be detected before evaluation. |
| Content MathML conversion | ✓ | Presentation MathML is converted internally before evaluation. |
| Symbolic algebra | ✗ | Not supported. Use a CAS for symbolic manipulation. |
Evaluation workflow
Expression evaluation follows these steps:
- The expression is received as MathML.
- If necessary, Presentation MathML is converted to Content MathML.
- The resulting Content MathML tree is validated.
- Variables are substituted.
- The expression is evaluated.
- The numerical result is returned.

Syntax checking
The evaluation engine operates only on expressions that are valid according to MathType's internal grammar. Syntax checking helps identify expressions that cannot be evaluated. For example:
- ✅
3 + 5 - ✅
x + 2 - ❌
3 +
Syntax checking can be enabled using the editor parameters:
editor.setParams({
toolbar: "evaluate",
checkSyntax: "true"
});The evaluate toolbar is specifically designed for authoring expressions intended for numerical evaluation.
Variables
Variables can be assigned values before evaluation. For example:
| Variable | Value |
|---|---|
x |
8.5 |
y |
2 |
The evaluation engine substitutes these values before performing the calculation.
Limitations
The evaluation engine performs numerical evaluation only. It does not support:
- Symbolic simplification.
- Equation solving.
- Symbolic differentiation.
- Symbolic integration.
- Algebraic transformations.
If these capabilities are required, use a Computer Algebra System (CAS).
Relationship with Content MathML
Expression evaluation depends on Content MathML. Presentation MathML expressions are converted into Content MathML before evaluation.
See Content MathML for more information about the conversion process.
Notes
- Only well-formed mathematical expressions can be evaluated.
- Invalid expressions result in evaluation errors.
- Decimal numbers always use the period (
.) as the decimal separator. - Variable names are case-sensitive.