Super-calculator

Compute any expression

Order of operations is respected: parentheses, powers, multiplications and divisions, then additions and subtractions.

= 2.5

Curve of the expression over x

Hover or touch the curve to read the value at each x.

Invalid range: the minimum must be lower than the maximum.

Saved formulas

Each formula keeps its expression, its variables, its x range and its number of points.

Save a formula to find it here on your next visit, without retyping it.

Speed

Measured in your browser over 500,000 calculations.

Compiled instructions

  1. 00VAR x
  2. 01CONST 2
  3. 02POW
  4. 03VAR y
  5. 04CONST 2
  6. 05POW
  7. 06ADD
  8. 07CALL sqrt/1
  9. 08CONST 1
  10. 09VAR x
  11. 10VAR y
  12. 11SUB
  13. 12CALL abs/1
  14. 13ADD
  15. 14DIV

Available functions

+ − × ÷ % ^ · sin cos tan asin acos atan sqrt cbrt abs ln log exp floor ceil round pow min max · pi e tau

Use it from your code

The same engine is available online: send an expression, get the result. An account is required: sign in, create your personal key, then send it with each call (60 calculations per minute per account). Get my key

POST https://pemdasai.com/api/public/calc

Expected JSON body: {"expr": "2 + 3 * x", "scope": {"x": 4}} → {"result": 14}

To compute several expressions in a single call (up to 100), use exprs / results — the full documentation, parameter by parameter, is on the API page.

{"exprs": ["x + 1", "x * 2"], "scope": {"x": 4}}
// -> {"results": [5, 8]}

Limit: 60 requests per minute per IP address (HTTP 429 beyond that). Calculation errors return HTTP 400 or 422 with {"error": "..."}.

Note: log is the natural logarithm, log10 is the base-10 logarithm.

Python example

import requests

r = requests.post(
    "https://pemdasai.com/api/public/calc",
    headers={"Authorization": "Bearer pk_VOTRE_CLE"},
    json={"expr": "2 + 3 * x", "scope": {"x": 4}},
)
print(r.json())  # {"result": 14}

JavaScript example

const res = await fetch("https://pemdasai.com/api/public/calc", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: "Bearer pk_VOTRE_CLE",
  },
  body: JSON.stringify({ expr: "2 + 3 * x", scope: { x: 4 } }),
});
const data = await res.json();
console.log(data); // { result: 14 }

curl example

curl -X POST https://pemdasai.com/api/public/calc \
  -H "Authorization: Bearer pk_VOTRE_CLE" \
  -H "Content-Type: application/json" \
  -d '{"expr": "2 + 3 * x", "scope": {"x": 4}}'