math.js is available as a RESTful API. Evaluations can be done via GET or POST requests. The duration per evaluation of this free service is limited to 10 seconds, with a maximum of 10,000 requests per day.
GET http://api.mathjs.org/v4/
Name | Type | Required | Description |
---|---|---|---|
expr | string | yes | The expression to be evaluated. The expression must be url encoded. |
precision | number | no | Number of significant digits in formatted output. Undefined by default. |
Expression | |
---|---|
Url | loading... |
POST http://api.mathjs.org/v4/
Must contain the following header:
content-type: application/json
The request body must contain a JSON Object with the following fields:
Name | Type | Required | Description |
---|---|---|---|
expr | string or string[] | yes | A string containing the expression to be evaluated, or an array with strings to be evaluated |
precision | number | no | Number of significant digits in formatted output. Undefined by default. |
The response is a JSON object containing the following fields:
Name | Type | Description |
---|---|---|
result | string, string[], or null |
On success, the field result contains a string with
the results of the expression. If an array with expressions was provided,
the result will be a an array with a string for each expression.
On failure, result will be null .
|
error | string or null | On failure, error will contain an error message.
On success, error will be null .
|