Skip to content
Back to search

equation.io

Graphing calculator with a built-in CAS — successor to graph.tk

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/aantthony/equation.io with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/aantthony/equation.io'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/aantthony--equation-io/badge.svg)](/listings/aantthony--equation-io)

HTML

<a href="/listings/aantthony--equation-io"><img src="/api/listings/aantthony--equation-io/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 352 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. # Equation.io
  2. **[equation.io](https://equation.io)** — a graphing calculator with a built-in
  3. CAS. Type equations; they compile to GPU shaders and render as 2D curves, 3D
  4. surfaces, vector fields, ODE phase portraits, probability densities, and more.
  5. Every graph lives entirely in its URL, so the address bar is the share button.
  6. ## The graph.tk story
  7. This is the successor to **graph.tk**, which started in this repository in
  8. May 2010 as an HTML5-canvas grapher and picked up 400+ stars over the years.
  9. The site ran on a free `.tk` domain — which turned out to be the fatal flaw:
  10. the registrar (Freenom) eventually seized the domain to serve ads on it, and
  11. after Meta sued Freenom the whole `.tk` registry collapsed and the domain
  12. stopped resolving entirely.
  13. The lesson was learned and the grapher was rebuilt from scratch — new parser,
  14. new CAS, WebGL rendering instead of canvas — on a domain that's actually owned:
  15. [equation.io](https://equation.io). The original code is preserved on the
  16. [`legacy`](../../tree/legacy) branch (tag `graph.tk-final`) under its original
  17. LGPL-3.0 terms; everything on `main` is a clean-room rewrite, MIT licensed.
  18. The old UI remains usable at [graph.equation.io](https://graph.equation.io).
  19. ## Architecture
  20. Deployed as a Cloudflare Worker. The page is `web/`; the mathematics is `lib/`.
  21. - `lib/expr.ts` is the tokenizer, the shunting-yard parser, and the expression
  22. tree. `lib/defs.ts` resolves names and definitions. Resolve-time expansions
  23. live with the mathematics they implement: `vector-calculus.ts` (gradient,
  24. divergence, curl), `sums.ts` (Σ and Π), and the integral, curve, and surface
  25. passes in `integrate.ts`, `curves.ts`, and `surface-geometry.ts`.
  26. - Distributions are `lib/dist.ts`. It re-exports base laws (`dist-base.ts`),
  27. continuous sampling (`dist-sample.ts`), discrete laws (`dist-discrete.ts`),
  28. and the random-variable system (`dist-system.ts`). The family table is
  29. `dist-families.ts`.
  30. - Geometry, tensors, measures, lists, and automata make up the rest of `lib/`:
  31. `geom.ts`, `pga.ts`, `clifford.ts`, `tensor.ts`, `measure.ts`, `list.ts`,
  32. `automaton.ts`, and the modules beside them. `compiler.ts` turns a classified
  33. row into a CPU plan and a GLSL plan (`glsl.ts`).
  34. - `web/main.ts` is the equation editor and the boot. `web/session.ts` owns the
  35. document, the panels, and the shared WebGL renderers. `web/scene.ts` builds
  36. one frame and hands it to the 2D and 3D renderers. Mutable state those three
  37. share lives on `web/app-state.ts`.
  38. - Every equation is compiled to a GLSL scalar field F whose zero set is the graph:
  39. - **2D**: fullscreen-quad fragment shader; the curve is drawn where the
  40. distance estimate |F|/|∇F| is under a pixel, with a two-scale consistency
  41. test rejecting fake lines at poles/asymptotes (e.g. `y=tan(x)`).
  42. - **3D** (automatic when `z` appears): raymarched implicit surface —
  43. sign-change detection along each ray, bisection refinement,
  44. finite-difference normals, `gl_FragDepth` so multiple surfaces intersect
  45. correctly. Equations without `z` extrude to their true locus in R³.
  46. The whole graph state lives in the URL (`/g/eq1;eq2;…`, each equation
  47. percent-encoded via `lib/link.ts`, which also escapes parens so chat-app
  48. linkifiers don't truncate the URL; legacy `/#…` links still load), so any set
  49. of equations is linkable and the address bar is the share mechanism.
  50. Agent-facing surface:
  51. - `/llms.txt` — link format + expression syntax reference
  52. ([`web/public/llms.txt`](web/public/llms.txt))
  53. - `/g/<eqs>` — share form of a graph link; the worker injects og:/twitter:
  54. meta tags (the graph's equations as the title, over the site card)
  55. - `/mcp` — stateless MCP server (Streamable HTTP) with `encode_graph_url`
  56. (validates rows, returns links), `decode_graph_url` (decodes links for editing),
  57. and `show_graph` (renders the interactive grapher inside MCP Apps hosts).
  58. See [MCP Apps integration and testing](docs/mcp-app.md).
  59. - `/.well-known/ard.json` (also at the older `/.well-known/ai-catalog.json`)
  60. — [Agentic Resource Discovery](https://agenticresourcediscovery.org/spec/)
  61. catalog listing the MCP server, and `/mcp/server-card` — its MCP Server
  62. Card. Both are generated from [`server.json`](server.json) by
  63. [`worker/discovery.ts`](worker/discovery.ts).
  64. ## Usage
  65. ```sh
  66. pnpm web # dev server (grapher + worker API)
  67. pnpm test # vitest
  68. pnpm typecheck # lib + web + worker
  69. pnpm web:build # build to dist-web/ (client + worker)
  70. pnpm deploy # build and deploy to Cloudflare
  71. ```
  72. ### Traffic and MCP usage
  73. ```sh
  74. pnpm traffic 7 # needs `wrangler login`
  75. ```
  76. Site visitors come from Cloudflare's own zone analytics. The script counts
  77. unique IPs per day on each page, using browser user agents only, and lists
  78. `/mcp` POSTs by client. Nothing on the site collects this.
  79. MCP tool calls are the one thing Cloudflare can't see, because it doesn't
  80. record request bodies. [`worker/mcp-usage.ts`](worker/mcp-usage.ts) writes one
  81. Analytics Engine point per `tools/call`: the tool, the client, the graph types,
  82. and row and error counts, never equation text. Set `CLOUDFLARE_API_TOKEN`, with
  83. Account Analytics: Read, for the script to include them.
  84. ## Examples
  85. **Basics**
  86. - `y = x^2` · `x^2+y^2=4` · `y = tan(x)` — 2D curves
  87. - `y = sin(2πx)` · `θ = 1; r = θ x` · `y = x³` — unicode input: π,
  88. Greek-letter names, superscript exponents, subscripts (`T₀` ≡ `T_0`, so
  89. `a₃` is a sequence term), and `·`/`×`/`÷`/`≤`/`≥`/`≠`;
  90. in the editor, typing `\pi`, `\theta`, `\nabla`, … inserts the symbol, and
  91. `\` before any function name just drops (`\trail` → `trail`)
  92. - `z = sin(x)cos(y)` · `x^2+y^2+z^2=9` — 3D surfaces (automatic when `z` appears)
  93. - `y < x/2 + 1` — inequalities shade their region; strict `<`/`>` have no
  94. border, `<=`/`>=` draw the boundary line, and chains like
  95. `4 <= x^2 + y^2 <= 9` intersect with an edge per non-strict bound
  96. - `y = {x < 0: -x, x >= 0: x^2}` — piecewise: `cond: value` cases tried in
  97. order, an optional last bare value is the default; conditions chain like
  98. `{0 < x < 1: 1, 0}`, and a bare condition counts 1 (`{x > 0, 5}`)
  99. - `y = {0 < x < 2: x^2}` — a domain restriction: with no default, the value
  100. is undefined outside the conditions, so nothing is drawn there
  101. - `sin(x)cos(y)` — a bare expression in x, y is a 2D scalar field, shaded
  102. in the row color where positive and its complement where negative. `sin(x)`
  103. is a field too (constant along y): the curve is `y = sin(x)`
  104. - `2+2`, `sqrt(a)`, `|A - B|` — a bare number draws nothing and reads out
  105. `= 4` under the row, live with sliders and `t`; write `y = 4` for the line
  106. **Sliders and animation**
  107. - `a = 2` — a named constant with a slider; other equations can use `a`, and
  108. it compiles to a uniform so dragging never rebuilds a shader. `b = a^2 + t`
  109. defines a computed/animated constant
  110. - `a := 2`, `f(x) := x^2` — the same definitions written explicitly. `:=` can
  111. also take over `e`, `pi`, `i`, `w` or `t` as a value (not a function) for
  112. the whole graph (`e := 0.6` is a slider; `t := 0.5` stops all animation);
  113. `u` and `v` take an interval (`u := interval(0, 2pi)`); `x`, `y`, `z` and
  114. `d` stay the language's
  115. - `(2, 3)` / `(3, 12, 0)` — points. In 2D, coordinates that are plain numbers
  116. or slider names can be dragged on the canvas, and the drag rewrites them:
  117. `a = 1; b = 2; (a, b)` moves both sliders, `(2sin(t), 3)` only its literal
  118. height
  119. - `(2cos(t), 2sin(t))` — `t` is seconds since load, so this point orbits
  120. **Calculus**
  121. - `f(x) = x^3 - a x` — user-defined functions, inlined symbolically
  122. - `f(z) = {re(z) >= 1: 1, f(4 - 3(z^6)^(1/6))}` then `f(x i - |y|) >= 0` —
  123. a tail-recursive function (every self-call a whole case of its `{…}`)
  124. runs as a bounded loop per pixel; this one shades the Koch snowflake
  125. - `y = d/dx f(x)` / `d^2/dx^2 (x^4)` — symbolic Leibniz derivatives; works for
  126. any single-letter variable, nests, and flows through function definitions:
  127. `g(x) = d/dx f(x)` then `y = f(a) + g(a)(x - a)` is a live tangent line
  128. **Probability**
  129. - `X ~ Normal(0, a)` — a random variable; the row plots its density, and
  130. parameters may use sliders. Then `P(X < b)`, `P(X > b)`, or `P(-1 < X < 2)`
  131. shades that area under the density and shows the numeric probability
  132. - Also `Uniform(lo, hi)`, `Exponential(rate)`, `Gamma(shape, rate)`, `Beta(a, b)`,
  133. `ChiSquared(df)`, `StudentT(df)` (or `T(5)`), `LogNormal(mu, sigma)`,
  134. `Cauchy(location, scale)`, `Weibull(shape, scale)` — exact densities, exact
  135. `P(…)`, and median/IQR readouts where heavy tails leave no σ to report
  136. - `erf`, `normalpdf(x, mean, sd)`, and `normalcdf(x, mean, sd)` are also plain
  137. functions, so `y = normalcdf(x, 0, 1)` graphs the CDF
  138. **Vector fields and ODEs**
  139. - `(-y, x)` — a tuple depending on x, y is a vector field, rendered as
  140. animated streamlines via GPU line-integral convolution; `t` works too:
  141. `(cos(t)-y, x)`
  142. - `grad(x^2 + y^2)` (or `∇(…)`) — the symbolic gradient as a tuple, so it
  143. plots as a vector field and works in `dot(grad(f), (1, 0))`
  144. - `dy/dx = x y` / `y' = sin(x) - y` — ODEs plot the slope/direction field
  145. `(1, f)`; click the canvas to drop an RK4 integral curve through that point,
  146. double-click to clear
  147. - `(x', y') = (y, -sin(x))` — a system plots its phase portrait, with the same
  148. click-to-trace trajectories
  149. **Simulation (states)**
  150. - `th' = om` (angle) with `om' = -sin(th)` (angular velocity) and `th(0) = 3` —
  151. a *state*: a prime on a name of your own is d/dt of it, integrated forward
  152. by RK4 at a fixed step as the graph animates — see
  153. [`lib/state.ts`](lib/state.ts). Everywhere else `th` behaves exactly like a
  154. constant, uniform and all, so drawing the system is ordinary plotting:
  155. `(sin(th), -cos(th))` is the bob, `(u sin(th), -u cos(th))` the rod. It is
  156. the one value in a graph that is not a formula in `t`, which is what makes a
  157. double pendulum — chaotic, no closed form — possible. Initial values get a
  158. slider that relaunches the run; ↻ in the panel restarts it
  159. - `r' = vel` with `vel' = -r/|r|^3` and `r(0) = (1, 0)` — a *vector state*: a
  160. derivative that is a 2- or 3-vector integrates componentwise as `r_1`,
  161. `r_2`(, `r_3`), and the bare name draws as a moving point and joins point
  162. arithmetic — an orbit in two rows
  163. - `label((2, 4), "peak")` / `label(A, "vertex")` — text beside a point,
  164. in the row's color; the point follows sliders and `t` like any other
  165. - `y = x^2 #e24` — a note that opens with a hex color draws the row in it
  166. - `trail(A)` — leaves a live motion trail behind a 2D or 3D point.
  167. For example, `A = (cos(t), sin(t)); trail(A)` draws an orbit as it runs;
  168. `trail((cos(t), sin(t), t/5))` draws a rising helix. Vector states work too.
  169. Trails retain up to 30 seconds / 2048 observed positions, reset when the
  170. equations or simulation restart, and are local to the current session.
  171. - `p(0) = ([0..299]/30, 0, 0)` — a *state family*: a list of starting values
  172. runs the system once per element (up to 1024), and states coupled to it run
  173. along. `p` then draws a cloud of moving points and `mean(p_1)` reduces
  174. across runs. Started from a tuple, `p(0) = (sort([0..299])/30, 0, 0)`, the
  175. runs are in order and `p[1]` is the first
  176. - `p(50..400)` — an *orbit*: where the state goes between those times,
  177. integrated ahead of time with the live simulation's own steps
  178. ([`lib/orbit.ts`](lib/orbit.ts)), so moving points ride their orbit. A
  179. family draws one path per run (`p[1](50..400)` draws one, when the runs
  180. start from a tuple); a scalar state plots against time, `th(0..20)` being
  181. the curve (t, th). With both, the Rössler attractor is a thin band of
  182. orbit with particles flowing along it
  183. **Custom coordinates and complex roots**
  184. - `r = sqrt(x^2+y^2); theta = atan2(y,x)` defines polar coordinates.
  185. `(r, theta) = (2, 9pi/4)` draws their point, with angles wrapping modulo 2π.
  186. Use literal or slider values on the right to drag the point in those coordinates.
  187. - `(r, theta) = (3u, 6pi u)` traces a three-turn spiral;
  188. `(r', theta') = (r(1-r), 1)` draws a polar limit-cycle field.
  189. - `1+2i` draws an Argand point; `w^3 = 1` draws the three cube roots of unity.
  190. Systems use a numerical search in the current view; small solution branches
  191. may be missed. Coordinate examples are available in the examples menu.
  192. **Matrices**
  193. - `M = ((a, b), (c, d))` — a tuple of rows is a 2×2 or 3×3 matrix (a
  194. bracket of tuples, `[(a, b), (c, d)]`, is two points); `det(M)`,
  195. `trace(M)`, the matvec `M v`, and `solve(M, v)` (Cramer's rule) expand
  196. symbolically at lowering time, see [`lib/mat.ts`](lib/mat.ts). So `(x', y') = A (x, y)` is a
  197. phase portrait with sliders in the entries, and `om' = solve(M, f)`
  198. integrates the double pendulum in the Lagrangian form M(θ)ω′ = f it is
  199. derived in
  200. **Parametric curves and surfaces**
  201. - `(2cos(2pi u), 2sin(2pi u), 3u)` — parametric curve, u ∈ (0,1)
  202. - `u^2` — a bare row in u, v alone draws its values: the density of u² for
  203. u uniform on [0, 1]
  204. - `(cos(2pi u)(2+cos(2pi v)), sin(2pi u)(2+cos(2pi v)), sin(2pi v))` —
  205. parametric surface, u,v ∈ (0,1); per-fragment Newton ray/surface
  206. intersection with a glossy specular material
  207. **Sequences and data**
  208. - `a_n = 1/n^2` — a sequence: dots at integer n ≥ 0; the Σ toggle on the row
  209. switches to partial sums S_N (this one converges to π²/6)
  210. - `a_{n+1} = r a_n (1 - a_n)` — a recurrence: draws the map's curve, the
  211. diagonal y = x, and the cobweb path from the seed `a_0` (define `a_0 = 0.2`
  212. for a slider, default ½). With `x` free on the right side, x becomes the
  213. parameter axis and the plot is the orbit/bifurcation diagram:
  214. `a_{n+1} = x a_n (1 - a_n)` is the logistic bifurcation
  215. - `[3, 1, 4, 1, 5]` — a data list: a dot plot on the number line, each value
  216. at x = value with its copies stacked (1 twice: dots at (1, 1) and (1, 2)).
  217. `[(1, 2), (3, 4)]` is a scatter of points
  218. **Regression**
  219. - `P = [(0, 1), (1, 3), (2, 5), (3, 7)]; P.y ~ m P.x + b` fits a line
  220. through the points. `P.x` and `P.y` are the lists of their coordinates,
  221. paired point by point like a data file's columns (two separately written
  222. lists `X`, `Y` are independent, so `(X, Y)` would be their grid).
  223. Unbound names `m` and `b` become fitted constants; `y = m x + b` draws the
  224. model and `(P.x, P.y - (m P.x + b))` draws its residuals. A fit row reports the
  225. coefficients, RMSE, R² (when defined), and observation count.
  226. - `P.y ~ a P.x^2 + b P.x + c` fits a polynomial; `P.y ~ a exp(b P.x)` fits a nonlinear
  227. model. Already defined constants stay fixed and changing them refits the
  228. other coefficients. Define data and fixed constants above the fit.
  229. - `data.height ~ m data.age + b` works with CSV columns. Missing/nonfinite
  230. data pairs are skipped with a count; mismatched lengths and unidentifiable
  231. coefficients are errors. Missing CSVs remain device-local in shared links.
  232. - Fits are static, with at most 8 coefficients and 10,000 observations
  233. (2,000 for nonlinear models). Nonlinear fitting uses deterministic starts
  234. and reports a local fit; it does not guarantee a global optimum.
  235. **Fourier analysis**
  236. - `s = interval(0, 1); fourier(cos(4pi s) + 0.5sin(10pi s))` — a one-sided
  237. amplitude spectrum. The interval is the signal's variable and its period,
  238. so frequency is in cycles per unit of it; a function reads over one as
  239. `fourier(f(s))`. 256 samples by default; `fourier(f(s), 512)` sets them.
  240. - `N = clamp(round(5), 0, 48); y = reconstruct(f(s), N)` — the signed mean
  241. plus the first N harmonics, preserving phase. An optional sample count
  242. follows N. The Fourier analysis examples show the original, spectrum and
  243. reconstruction in linked views.
  244. - `S = sort(data.signal, data.row); fourier(S)` — equally spaced CSV samples
  245. in file order, spanning [0, 1) or `fourier(S, interval(0, 10))`. Tuples
  246. work too, `fourier((0, 1, 0, -1))`; bracket lists
  247. have no order. Samples must be finite real numbers, with no gaps. Both
  248. operations assume periodic continuation and static signals; coefficients
  249. recompute when signal sliders change. Reconstruction supports up to 128
  250. harmonics; sample counts range from 2 to 4096.
  251. **Contextual syntax help**
  252. The equation editor suggests functions, defined names, and loaded CSV columns
  253. as you type, and shows signatures inside function calls. Tab or a click
  254. inserts a suggestion; arrow keys select one for Enter to insert. Enter
  255. otherwise creates an equation row, Escape dismisses help, and completion is
  256. one undoable text edit. Comments and quoted strings do not trigger suggestions.
  257. **Number theory and complex analysis**
  258. - `gcd(a, b)` / `isprime(n)` — number theory; try `a_n = isprime(n)`
  259. - `ln(w-2) - ln(w+2)` — complex analysis: `i` is the imaginary unit and
  260. `w = x + iy`; a complex-valued expression renders the level curves of its
  261. imaginary part (field lines) and real part (equipotentials), so complex
  262. potentials draw electrostatics directly. `re`/`im`/`arg`/`abs`/`conj` bring
  263. values back to ℝ, e.g. `im(ln(w)) = 1` plots as an ordinary implicit curve
  264. Equations persist in the URL hash. Drag to pan/orbit, wheel to zoom,
  265. right-drag (or shift) to pan in 3D, click a color dot to cycle colors. Points
  266. and dropped ODE seeds highlight under the cursor and drag with it. The
  267. equations panel is a corner-pinned card: flick it — touch anywhere on it, or
  268. drag the grip strip along its top edge with a mouse — to send it to any
  269. corner, or throw it past any edge to clear the view entirely; it tracks the
  270. pointer and leaves along the throw. The `y=` chip left behind brings it back
  271. (tap it, or drag it to pull the panel in), and the chosen corner sticks.
  272. `worker/` — the Cloudflare Worker entry: serves the built app and handles
  273. `/api/*` routes.
  274. ## Contributing
  275. You need Node 24 and pnpm. Run `pnpm install`, then `pnpm web` for the dev server.
  276. Before opening a PR, run the same checks CI runs:
  277. ```sh
  278. pnpm typecheck # tsc over lib, web and worker
  279. pnpm lint # Oxlint, including type-aware rules
  280. pnpm fmt:check # Oxfmt (pnpm fmt rewrites files in place)
  281. pnpm vitest run # unit tests
  282. ```
  283. `pnpm lint:fix` applies the fixes Oxlint can make automatically. In VS Code,
  284. install the recommended Oxc extension to see lint errors as you type.
  285. ## License
  286. MIT — see [LICENSE](LICENSE). The pre-2026 graph.tk code on the
  287. [`legacy`](../../tree/legacy) branch remains under its original LGPL-3.0
  288. terms; no code from it was reused in the current codebase.
  289. ## Axis scaling
  290. Option/Alt + drag the 2D canvas to scale each axis independently: horizontal
  291. movement scales x and vertical movement scales y, anchored at the initial
  292. pointer position. Normal zoom preserves the ratio. Set `ratio = 1` in the
  293. viewport row to restore equal axis units.
  294. Scaling creates or updates a shareable viewport row:
  295. `view(x = -10..10, y = -1..1, ratio = 5)`. The positive `ratio` is pixels per
  296. y unit divided by pixels per x unit; omitted means 1. The bounds are fitted
  297. with that ratio preserved, including on different screen sizes.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.