-
MathType
-
WirisQuizzes
-
Nubric
-
CalcMe
-
MathPlayer
-
Store FAQ
-
MathFlow
-
BF FAQ
-
Miscellaneous
-
Wiris Integrations
Evaluation service reference
Reading time: 1minReference for the MathType evaluation service used to compute the numerical value of mathematical expressions.
Summary
The MathType evaluation service computes the numerical value of mathematical expressions represented as MathML. Variables can be assigned values at request time, allowing expressions to be evaluated dynamically. This service is intended for applications that require performing mathematical calculations programmatically.
Available interfaces
The evaluation service is available through the following interfaces.
| Interface | Availability |
|---|---|
| HTTP endpoint | Cloud and self-hosted deployments |
| Java API | Self-hosted Java deployments |
| .NET API | Self-hosted .NET deployments |
HTTP endpoint
The endpoint URL depends on your deployment.
| Deployment | Endpoint |
|---|---|
| Java | /pluginwiris_engine/app/evaluate |
| PHP | /integration/evaluate.php |
Both GET and POST requests are supported. POST is recommended for large MathML expressions.
Request parameters
The evaluation service accepts the following request parameters.
| Parameter | Required | Description |
|---|---|---|
mml |
Yes | Presentation MathML expression to evaluate. |
var_<name> |
No | Assigns a value to a variable before evaluation. For example, var_x=8.5. |
Variables are supplied by prefixing the variable name with var_.
Example requests
Evaluate a constant expression:
GET /evaluate?mml=<math><mn>1</mn><mo>-</mo><mn>2</mn></math>Evaluate an expression containing variables:
GET /evaluate?mml=<math><mi>x</mi><mo>-</mo><mn>2</mn></math>&var_x=8.5Use POST when sending large MathML expressions.
Response
The service returns the numerical result of the evaluated expression.
Error handling
Evaluation may fail if:
- The supplied MathML is not valid.
- The expression cannot be evaluated because of a syntax error.
- An arithmetic error occurs (for example, division by zero).
In these situations, the service returns an HTTP 5xx error.
Notes
- Only well-formed mathematical expressions can be evaluated.
- Variables are optional and can be supplied dynamically with each request.
- The evaluation engine internally converts Presentation MathML into Content MathML before performing the calculation.
Java and .NET APIs
The evaluation service is also available through the Java and .NET APIs. For complete method signatures, return types, and implementation details, see: