# Math Solver API: Equations, Calculus & Algebra, Step by Step (`jumblemog/math-solver`) Actor

Solve math in plain words, LaTeX or SymPy syntax: equations, derivatives and integrals with steps, limits, series, matrices, differential equations, statistics and unit conversions. Exact answers, decimals, LaTeX and graphs. A Wolfram Alpha alternative for AI agents.

- **URL**: https://apify.com/jumblemog/math-solver.md
- **Developed by:** [Jumble Mog](https://apify.com/jumblemog) (community)
- **Categories:** AI, Developer tools, Automation
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Math Solver API: Equations, Calculus & Algebra, Step by Step

**Solve math problems the way you would type them.** Write a problem in plain words, math notation, LaTeX or SymPy syntax (`solve x^2 - 5x + 6 = 0`, `integrate x^2 sin(x) dx`, `\lim_{x \to 0} \frac{\sin x}{x}`, `convert 5 miles to km`) and get the exact answer, a decimal to any precision, the answer in LaTeX, step-by-step working and a graph. Equations and inequalities, derivatives, integrals, limits, series, sums, differential equations, matrices, number theory, statistics and unit conversions, worked out by the [SymPy](https://www.sympy.org) computer algebra system. A pay-per-problem Wolfram Alpha alternative that people, spreadsheets, automations and AI agents can call.

![Math Solver examples: a quadratic equation, an integral by parts, a derivative, a limit, the sum of 1/n² equal to π²/6, a second-order differential equation, a LaTeX integral and a unit conversion, next to four graphs it drew: sine and cosine, the shaded area under x² from 0 to 2, the circle x² + y² = 25 and tan(x) with its asymptotes](https://api.apify.com/v2/key-value-stores/Km5b4PG3kYHdZSb1E/records/math-solver-examples.png?signature=bjRPCZ5mgoQDy0r0kD8W)

### What it does

- **Equations**: polynomial, rational, radical, absolute value, exponential, logarithmic and trigonometric equations. Periodic equations get every solution (`x = π*n + π/4, for any integer n`), polynomials get their complex roots too, and equations with no formula are solved numerically (`cos(x) = x` gives `x ≈ 0.739085133215161`). Systems of linear and nonlinear equations, equations with letters (`solve a*x^2 + b*x + c = 0 for x`), and where two curves meet.
- **Inequalities**: `x^2 > 4` is `x < -2 or x > 2`, with interval notation. Chains like `0 < 2x - 1 < 5` work too.
- **Derivatives**: any order, partial derivatives, values at a point (`derivative of x^3 at x = 2`), and `f'(x) if f(x) = ...`, with the product, quotient and chain rule steps.
- **Integrals**: indefinite (`+ C`), definite, improper (to infinity) and double integrals, with substitution, integration by parts and partial fraction steps. Integrals that diverge are reported as diverging, with the Cauchy principal value where it exists, and integrals with no closed form are computed numerically and cross-checked, so a divergent integral never comes back as a made-up number.
- **Limits**: two-sided, one-sided and at infinity, with L'Hôpital steps. Limits that don't exist say why (`the limit from the left is -∞, from the right ∞`).
- **Series and sums**: Taylor and Maclaurin series around any point, sums and products with a formula (`sum of k^2 for k from 1 to n`), and infinite series (`sum 1/n^2, n = 1..oo` is `π^2/6`).
- **Differential equations**: first and second order ODEs, with initial conditions (`y'' + 4y = sin(x), y(0) = 0, y'(0) = 1`), the method used and the general solution.
- **Algebra**: simplify, expand, factor, partial fractions, combine and cancel fractions, rationalize, trig and log identities, functions you define (`f(x) = x^2 + 1, find f(3)`), and true or false checks (`is sin(x)^2 + cos(x)^2 = 1`).
- **Linear algebra**: determinant, inverse, transpose, rank, trace, reduced row echelon form, eigenvalues and eigenvectors, null space, characteristic polynomial, diagonalization, and matrix sums, products and powers.
- **Numbers**: exact arithmetic with fractions and huge integers (`100!`), any number of digits (`pi to 1000 digits`), complex numbers, primes and prime factorization, GCD and LCM, divisors, Euler's totient, the nth prime or Fibonacci number, bases 2 to 36 and Roman numerals, and the closed form of a decimal (`1.4142135623731` is `sqrt(2)`).
- **Optimization**: minimum and maximum (on an interval too), critical points and what kind they are, inflection points, and critical points of functions of two variables.
- **Statistics**: mean, median, mode, sample and population variance and standard deviation, geometric and harmonic mean, range and more.
- **Units**: length, area, volume, mass, time, speed, energy, power, pressure and data sizes, plus °C, °F and K (`98.6 °F in °C`, `how many feet in a mile`, `60 mph to km/h`).
- **Graphs**: functions, several functions together, the shaded area of a definite integral, a function with its derivative or a Taylor polynomial, both sides of an equation, and curves like `x^2 + y^2 = 25`, as PNG or SVG.

### Ways to write a problem

| Style | Examples |
| --- | --- |
| Plain words | `solve x^2 - 5x + 6 = 0`, `derivative of x^2 sin(x)`, `area under x^2 from 0 to 2`, `limit of (1 + 1/n)^n as n approaches infinity`, `two plus three times four`, `what is 15% of 80` |
| Math notation | `x² + 3x − 5 = 0`, `∫ x e^x dx`, `|x - 1| < 3`, `sin(30°)`, `5!`, `log_2(8)`, `y'' - 3y' + 2y = 0`, `dy/dx = x*y` |
| LaTeX | `\int_0^1 x^2 \, dx`, `\frac{d}{dx} \sin(x^2)`, `\sum_{k=1}^{n} k^2`, `\begin{vmatrix} 1 & 2 \\ 3 & 4 \end{vmatrix}`, `$x^2 = 4$` |
| SymPy syntax | `integrate(x**2, (x, 0, 1))`, `diff(x**3, x, 2)`, `limit(sin(x)/x, x, 0)`, `series(cos(x), x, 0, 8)`, `solve([x + y - 3, x - y - 1], [x, y])`, `N(pi, 30)` |

Implicit multiplication works (`2x`, `x y`, `2 pi r`), `^` and `**` both mean powers, `e` and `i` are Euler's number and the imaginary unit, `log` and `ln` are the natural logarithm, and Greek letters can be written as symbols (`θ`) or names (`theta`).

### How to use it

1. Type a problem into **Problem**, or many into **More problems**.
2. Keep **Operation** on Detect, or pick one (such as Integral) to apply it to bare expressions like `x^2 sin(x)`.
3. Click **Start**. The answers appear in the **Output** tab, one row per problem.

You can also run it through the [Apify API](https://docs.apify.com/api/v2), on a schedule, or from Make, n8n, Zapier and other integrations.

### How-to examples

Each example below is a complete input, checked with a run of the Actor.

#### How to solve an equation with an API

```json
{"problem": "solve x^2 - 5x + 6 = 0"}
```

Result: `"answer": "x = 2 or x = 3"`, with the solutions as a list, in LaTeX (`x = 2 \quad\text{or}\quad x = 3`) and as decimals.

#### How to get a derivative or an integral with steps

```json
{"problem": "derivative of x^2 sin(x)"}
```

Result: `"answer": "x*(x*cos(x) + 2*sin(x))"`, the unsimplified form `x^2*cos(x) + 2*x*sin(x)`, and five `steps` in words and LaTeX, starting "Use the product rule with $u = x^{2}$ and $v = \sin{\left(x \right)}$". Add `"plot": true` for a graph.

#### How to solve many problems in one call, in any notation

```json
{"problems": ["integrate x e^x", "\\int_0^1 x^2 \\, dx", "y'' - 3y' + 2y = 0", "what is 15% of 80"]}
```

Result, one row each: `(x - 1)*e^x + C`; `1/3` (0.333333333333333); `y(x) = C1*e^x + C2*e^(2*x)`; and `12`. Plain words, math symbols, LaTeX and SymPy syntax can be mixed.

#### How to let an AI agent do exact math

Add this Actor to the [Apify MCP server](https://mcp.apify.com) with `https://mcp.apify.com/?tools=jumblemog/math-solver`. Language models make arithmetic and algebra slips, so the agent sends the problem as written and gives the user `answer`, or `latex` for a formatted answer, with the `steps`.

### FAQ

**What can it solve?** Arithmetic, algebra, equations and systems, inequalities, derivatives, integrals, limits, series, sums, matrices and determinants, and differential equations.

**Are the answers exact?** Yes. It uses SymPy, a computer algebra system, so `1/3` stays `1/3` and `sqrt(2)` stays exact, with a decimal value next to it.

**Does it show the steps?** For derivatives and other common problems, yes, in words and LaTeX.

**Can it read LaTeX?** Yes, as well as plain words ("area under x^2 from 0 to 2"), math symbols (`∫`, `²`, `√`) and SymPy syntax.

**Does it work with Zapier, Make or n8n?** Yes. Call the Actor with its Apify app or an HTTP request and pass `answer` or `latex` on.

### Input

| Field | What it does |
| --- | --- |
| `problem` | One math problem. |
| `problems` | More problems, each answered (and charged) on its own. Up to 1,000 per run. |
| `operation` | `auto` (default: read it from the problem), `evaluate`, `simplify`, `expand`, `factor`, `solve`, `derivative`, `integral`, `limit`, `series` or `plot`. |
| `variable` | The variable to solve for, differentiate or integrate by, when the problem doesn't say. By default x, then y, z, t and the first other letter. |
| `showSteps` | Step-by-step working for derivatives, integrals, limits, Taylor series, equations and differential equations (on by default). |
| `digits` | Significant digits of the decimal answers (15 by default, up to 1,000). |
| `domain` | Where equations are solved: `auto` (default), `real` or `complex`. |
| `plot`, `plotFrom`, `plotTo`, `plotFormat` | Draw a graph for each answer in one variable, its x range (such as `-2*pi` to `2*pi`), and `png` (default) or `svg`. Problems that start with `plot` are always drawn. |
| `timeoutSeconds` | The time limit for one problem (30 s by default, up to 120). A run stops early if its timed-out problems add up to more than 3 minutes. |

Many problems in one run:

```json
{
  "problems": [
    "solve x^2 - 5x + 6 = 0",
    "integrate x^2 sin(x) dx",
    "limit of sin(x)/x as x -> 0",
    "\\sum_{k=1}^{n} k^2",
    "eigenvalues of [[2, 1], [1, 2]]",
    "convert 60 mph to km/h"
  ]
}
```

An integral with its graph:

```json
{"problem": "integrate x^2 from 0 to 2", "plot": true}
```

### Output

Each problem becomes one dataset item:

```json
{
  "index": 1,
  "problem": "solve x^2 - 5x + 6 = 0",
  "operation": "solve",
  "interpretation": "solve x^2 - 5*x + 6 = 0 for x",
  "interpretationLatex": "x^{2} - 5 x + 6 = 0",
  "answer": "x = 2 or x = 3",
  "result": "[2, 3]",
  "latex": "x = 2 \\quad\\text{or}\\quad x = 3",
  "numeric": "2, 3",
  "solutions": [{"x": "2"}, {"x": "3"}],
  "solutionsLatex": [{"x": "2"}, {"x": "3"}],
  "solutionsNumeric": [{"x": "2"}, {"x": "3"}],
  "steps": [
    "This is quadratic, $a x^2 + b x + c = 0$ with $a = 1$, $b = -5$ and $c = 6$.",
    "The discriminant is $b^2 - 4ac = 1$, so there are two real solutions.",
    "Use the quadratic formula $x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}$: $x = 3 \\text{ or } x = 2$."
  ],
  "alternateForms": null,
  "notes": [],
  "error": null,
  "processingSeconds": 0.027,
  "plotUrl": null
}
```

| Field | What it holds |
| --- | --- |
| `answer` | The answer as readable text: `x^2`, `sqrt(2)`, `π`, `e`, `i`, `∞`, `ln(x)`. |
| `result` | The answer in SymPy syntax, which SymPy and this Actor can read back. |
| `latex` | The answer in LaTeX, ready for MathJax or KaTeX. |
| `numeric` | The decimal value, with the digits you asked for (when the answer is a number). |
| `solutions`, `solutionsLatex`, `solutionsNumeric` | Each solution of an equation or system as `{"x": "..."}`, in the three forms. |
| `interpretation`, `interpretationLatex` | How the problem was read, so you can check it was understood as you meant. |
| `steps` | The working, as sentences with LaTeX between `$` signs. |
| `alternateForms` | Other ways to write the answer: factored, expanded, partial fractions, interval notation, mixed fraction, polar form, exact value. |
| `notes` | Things worth knowing: the constant of integration, complex solutions left out, where a numeric answer came from. |
| `plotUrl` | A link to the graph, when one was drawn. |
| `error` | Why a problem couldn't be answered, such as `Couldn't tell what to do with '5 apples to oranges' (the word 'to' isn't math). Try a command such as 'solve ...', 'integrate ... from 0 to 1' or 'convert 5 miles to km'.` |

All the answers are also saved together as the run's `OUTPUT` record, so the run-sync API endpoint returns them in one response. Graphs live in the run's key-value store; download them within your plan's data retention period.

### Pricing

You pay per **problem solved**, at the price shown on this page. Problems that can't be read, can't be solved or run out of time are never charged. If you set a maximum cost per run, the Actor stops when the next problem wouldn't fit.

### Speed

Most problems take a few hundredths of a second; hard integrals, big systems and numeric solving can take a few seconds. A run with one problem takes about 3 to 6 seconds through the API, most of it the run starting up, so send many problems in one run when you can.

### Tips and limits

- When a problem isn't understood, the error says why. Rephrasing as a command (`solve ...`, `integrate ... from a to b`, `derivative of ...`, `limit of ... as x -> a`, `convert ... to ...`) or as SymPy syntax always works.
- Answers are exact when SymPy finds an exact form. Equations with no formula fall back to numeric solutions between -100 and 100, and integrals with no closed form to a checked numeric value.
- `domain` decides whether equations are solved over the real or complex numbers; inequalities are always solved over the reals.
- Each problem runs in a separate, unprivileged process with a memory cap and the time limit you choose, so a problem that is too hard is stopped cleanly and the rest of the run carries on.
- Problems can be up to 5,000 characters. Python code (attribute access, imports, strings) isn't accepted, only math.
- Word problems in full sentences ("a train leaves at 3 pm...") aren't parsed; turn them into equations first, which is easy for an AI model.

### For AI agents and developers

Language models are good at turning questions into math and bad at exact arithmetic, algebra and calculus. This Actor is the calculator they can call: it works with the [Apify MCP server](https://mcp.apify.com), so agents can use it as a tool. Pass the problem in `problem` and read `answer` (or `numeric` and `latex`) from the result. For a direct API call that waits for the answer:

```bash
curl -X POST "https://api.apify.com/v2/acts/jumblemog~math-solver/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"problem": "integrate x^2 sin(x) dx"}'
```

Or get every answer of a batch in one JSON response with `run-sync`, which returns the run's `OUTPUT`:

```bash
curl -X POST "https://api.apify.com/v2/acts/jumblemog~math-solver/run-sync?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"problems": ["solve x^3 = 8", "derivative of ln(x)/x", "sum 1/2^k for k = 0 to infinity"], "showSteps": false}'
```

### Credits

- Built on [SymPy](https://www.sympy.org) (BSD-3-Clause) with [mpmath](https://mpmath.org) (BSD-3-Clause), [NumPy](https://numpy.org) (BSD-3-Clause), [Matplotlib](https://matplotlib.org) (PSF-based Matplotlib license) and [Lark](https://github.com/lark-parser/lark) (MIT).
- This Actor isn't affiliated with Wolfram Research, Wolfram Alpha or the SymPy project.

# Actor input Schema

## `problem` (type: `string`):

One math problem, written the way you would ask it: "solve x^2 - 5x + 6 = 0", "integrate x^2 sin(x) dx", "integrate e^(-x^2) from -oo to oo", "derivative of x^3 at x = 2", "limit of sin(x)/x as x -> 0", "taylor series of cos(x) to order 6", "sum k^2 for k from 1 to n", "y'' + y = 0, y(0) = 1, y'(0) = 0", "eigenvalues of \[\[2, 1], \[1, 2]]", "convert 5 miles to km", "mean of 3, 5, 8" or just "2^100". LaTeX (\int_0^1 x^2,dx) and SymPy calls (integrate(x\*\*2, (x, 0, 1))) work too. Several equations separated by commas or on separate lines are solved together.

## `problems` (type: `array`):

More problems, one per entry, each answered (and charged) on its own. Use this to solve many problems in one run.

## `operation` (type: `string`):

What to do with each problem. 'Detect' reads it from the words (solve, integrate, limit of ...) or the math itself (an equation is solved, an expression simplified). Pick an operation to apply it to bare expressions, such as Integral for 'x^2 sin(x)'.

## `variable` (type: `string`):

The variable to solve for, differentiate or integrate by, when the problem doesn't say (as in 'for x' or 'dx'). Left empty, x is used if present, otherwise y, z, t and then the first other letter.

## `showSteps` (type: `boolean`):

Explain how the answer was found, step by step, for derivatives (product, quotient and chain rules), integrals (substitution, integration by parts, partial fractions), limits (L'Hôpital's rule), Taylor series and linear and quadratic equations. Steps are sentences with LaTeX between $ signs.

## `digits` (type: `integer`):

Significant digits for decimal answers (the numeric field). Exact answers such as sqrt(2) or pi/4 are always given too. A problem can also ask for digits itself: 'pi to 100 digits'.

## `domain` (type: `string`):

Where equations are solved. Auto lists every solution of polynomial equations (complex ones too) and the real solutions of equations like 2^x = 8, noting complex families separately. Inequalities are always solved over the reals.

## `plot` (type: `boolean`):

Draw a graph for answers in one variable: the function, its derivative, the area of a definite integral, a Taylor polynomial against the function, or both sides of an equation. 'plot ...' problems are always drawn. Graphs are saved in the run's key-value store and linked in plotUrl.

## `plotFrom` (type: `string`):

Left end of the x range for graphs, such as -10 or -2\*pi. Left empty, the range fits the problem (-10 to 10, or -2π to 2π for trig functions).

## `plotTo` (type: `string`):

Right end of the x range for graphs, such as 10 or 2\*pi.

## `plotFormat` (type: `string`):

File format of the graphs.

## `timeoutSeconds` (type: `integer`):

Stop working on a problem after this long and report it as timed out (not charged). Most problems take well under a second; hard integrals and big systems can take longer. Up to 120 s; a run stops early if its timed-out problems add up to more than 3 minutes.

## Actor input object example

```json
{
  "problem": "solve x^2 - 5x + 6 = 0",
  "operation": "auto",
  "showSteps": true,
  "digits": 15,
  "domain": "auto",
  "plot": false,
  "plotFormat": "png",
  "timeoutSeconds": 30
}
```

# Actor output Schema

## `results` (type: `string`):

One item per problem: the answer in every form, steps, notes, or the error.

## `output` (type: `string`):

The OUTPUT record: {"results": \[...]} with every answer, also returned by the run-sync API endpoint.

## `files` (type: `string`):

The graph files saved in the run's key-value store.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "problem": "solve x^2 - 5x + 6 = 0"
};

// Run the Actor and wait for it to finish
const run = await client.actor("jumblemog/math-solver").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "problem": "solve x^2 - 5x + 6 = 0" }

# Run the Actor and wait for it to finish
run = client.actor("jumblemog/math-solver").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "problem": "solve x^2 - 5x + 6 = 0"
}' |
apify call jumblemog/math-solver --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,jumblemog/math-solver"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/NUWF2HgK4VhxNSWPp/builds/Rish0M7mL87xkjBl2/openapi.json
