# Polynomial API
> Work with polynomials: find their roots, evaluate them, differentiate and integrate, and add, subtract, multiply or divide them. The roots endpoint returns every root — real and complex — using the exact quadratic formula for degree 2 and the Durand-Kerner method for higher degrees, with a clean list of just the real roots too. The evaluate endpoint computes p(x) and p'(x) at a point by Horner's method. The derivative endpoint returns the coefficients of the derivative and of the indefinite integral. The operate endpoint does polynomial arithmetic — addition, subtraction, multiplication, and long division giving a quotient and a remainder. Coefficients are given highest-degree first, so [1,-3,2] means x² − 3x + 2. Everything is computed locally and deterministically, so it is instant and private. Ideal for engineering and control systems, signal processing and filter design, computer graphics and curve fitting, scientific computing, and teaching algebra and calculus. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 5 endpoints. This is polynomial maths; for matrices and linear systems use a matrix API, for vectors a vector API, and for general arithmetic a math API.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/polynomial-api/..."
```

## Pricing
- **Free** (Free) — 6,035 calls/Mo, 2 req/s
- **Starter** ($8/Mo) — 15,550 calls/Mo, 8 req/s
- **Pro** ($27/Mo) — 206,500 calls/Mo, 20 req/s
- **Mega** ($65/Mo) — 1,075,000 calls/Mo, 50 req/s

## Endpoints

### Polynomial

#### `GET /v1/derivative` — Derivative and integral

**Parameters:**
- `coefficients` (query, required, string) — Highest degree first Example: `[1,-3,2]`
- `constant` (query, optional, string) — Integration constant Example: `0`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/polynomial-api/v1/derivative?coefficients=%5B1%2C-3%2C2%5D&constant=0"
```

**Response:**
```json
{
    "data": {
        "degree": 2,
        "integral": [
            0.333333333333,
            -1.5,
            2,
            0
        ],
        "derivative": [
            2,
            -3
        ],
        "coefficients": [
            1,
            -3,
            2
        ]
    },
    "meta": {
        "timestamp": "2026-06-03T17:42:14.974Z",
        "request_id": "01ba29ac-98dc-475e-92f4-8adb3597de14"
    },
    "status": "ok",
    "message": "Derivative",
    "success": true
}
```

#### `GET /v1/evaluate` — Evaluate p(x) and p'(x)

**Parameters:**
- `coefficients` (query, required, string) — Highest degree first Example: `[1,-3,2]`
- `x` (query, required, string) — The point Example: `5`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/polynomial-api/v1/evaluate?coefficients=%5B1%2C-3%2C2%5D&x=5"
```

**Response:**
```json
{
    "data": {
        "x": 5,
        "value": 12,
        "degree": 2,
        "derivative_value": 7
    },
    "meta": {
        "timestamp": "2026-06-03T17:42:15.081Z",
        "request_id": "dfcf5e46-9996-49a6-9220-811b616705bc"
    },
    "status": "ok",
    "message": "Evaluate",
    "success": true
}
```

#### `GET /v1/operate` — Polynomial arithmetic

**Parameters:**
- `a` (query, required, string) — First polynomial Example: `[1,1]`
- `b` (query, required, string) — Second polynomial Example: `[1,-1]`
- `op` (query, optional, string) — add|subtract|multiply|divide Example: `multiply`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/polynomial-api/v1/operate?a=%5B1%2C1%5D&b=%5B1%2C-1%5D&op=multiply"
```

**Response:**
```json
{
    "data": {
        "op": "multiply",
        "result": [
            1,
            0,
            -1
        ]
    },
    "meta": {
        "timestamp": "2026-06-03T17:42:15.196Z",
        "request_id": "7890c468-4fc4-4c3a-bc22-c4d625d3a12f"
    },
    "status": "ok",
    "message": "Operate",
    "success": true
}
```

#### `GET /v1/roots` — Find all roots

**Parameters:**
- `coefficients` (query, required, string) — Highest degree first Example: `[1,-6,11,-6]`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/polynomial-api/v1/roots?coefficients=%5B1%2C-6%2C11%2C-6%5D"
```

**Response:**
```json
{
    "data": {
        "roots": [
            {
                "im": 0,
                "re": 1,
                "is_real": true
            },
            {
                "im": 0,
                "re": 2,
                "is_real": true
            },
            {
                "im": 0,
                "re": 3,
                "is_real": true
            }
        ],
        "degree": 3,
        "real_roots": [
            1,
            2,
            3
        ]
    },
    "meta": {
        "timestamp": "2026-06-03T17:42:15.273Z",
        "request_id": "26c7e332-6d5b-478f-b8d9-265037bdf5e5"
    },
    "status": "ok",
    "message": "Roots",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Spec

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/polynomial-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "name": "Polynomial API",
        "notes": "Degree up to 100. Complex roots are found numerically (Durand-Kerner) and converge to ~1e-14. Nothing is stored.",
        "version": "v1",
        "endpoints": [
            {
                "path": "/v1/roots",
                "params": {
                    "coefficients": "e.g. [1,-3,2]"
                },
                "returns": "all roots (real and complex) and a real-only list"
            },
            {
                "path": "/v1/evaluate",
                "params": {
                    "x": "the point",
                    "coefficients": "e.g. [1,-3,2]"
                },
                "returns": "p(x) and p'(x)"
            },
            {
                "path": "/v1/derivative",
                "params": {
                    "constant": "integration constant (optional)",
                    "coefficients": "e.g. [1,-3,2]"
                },
                "returns": "derivative and integral coefficients"
            },
            {
                "path": "/v1/operate",
                "params": {
                    "a": "first polynomial",
                    "b": "second polynomial",
                    "op": "add|subtract|multiply|divide"
                },
                "returns": "the resulting polynomial (quotient+remainder for divide)"
            },
            {
                "path": "/v1/meta",
                "params": [],
                "returns": "this document"

…(truncated, see openapi.json for full schema)
```


---
Marketplace page: https://www.oanor.com/api/polynomial-api
OpenAPI spec: https://www.oanor.com/api/polynomial-api/openapi.json
