Equation.io

io.equation由 equation.io 發布官方發布者v1.0.1更新於 Oct 25, 2026

Create interactive 2D and 3D graphs with validated equations, shareable links, and PNG previews.

已驗證Streamable HTTP可網頁執行資料與分析媒體與設計

概覽

AI 產生的概覽

Equation.io 繪圖計算機 MCP 伺服器,讓助理建立、解碼並展示可分享連結的互動式二維與三維方程式圖形。

可以做什麼
依方程式列清單建立經過驗證的圖形連結,回傳 /g/ 分享形式或舊版 # 片段形式的可分享網址,編輯既有圖形時保留未更動的列。解碼既有的 equation.io 連結,還原其方程式列,以便修改後重新編碼。在對話中展示互動式圖形,支援編輯方程式、滑桿、平移縮放與三維旋轉。方程式列使用 equation.io 運算式語法,涵蓋曲線、曲面、不等式、分段定義、微積分、機率、向量場、常微分方程、矩陣、數列、迴歸與傅立葉分析。
適用情境
適合使用者想要繪製、探索或分享數學圖形時使用,從簡單二維曲線到三維曲面、向量場與常微分方程相圖,也適合解碼並編輯既有的 equation.io 連結。較適合數學、教學與快速視覺化探索,而非資料量大的圖表製作。
執行需求
位於 equation.io 的遠端 Streamable HTTP 端點;未宣告任何套件、環境變數或請求標頭。show_graph 的互動式展示依賴支援 MCP Apps 的宿主,否則連結相關工具仍可使用。
安裝前請注意
整個圖形狀態都編碼在網址中,因此產生或解碼的連結會攜帶方程式內容,任何取得連結的人都能查看。工具呼叫會記錄為分析資料點(工具、用戶端、圖形類型、列數與錯誤數,絕不含方程式文字)。缺失的 CSV 資料在分享連結中仍保留在本機裝置。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Equation.io,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/io.equation%2Fequation/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。

{
  "mcpServers": {
    "equation-io": {
      "type": "http",
      "url": "https://equation.io/mcp"
    }
  }
}

README

Equation.io

equation.io — a graphing calculator with a built-in CAS. Type equations; they compile to GPU shaders and render as 2D curves, 3D surfaces, vector fields, ODE phase portraits, probability densities, and more. Every graph lives entirely in its URL, so the address bar is the share button.

The graph.tk story

This is the successor to graph.tk, which started in this repository in May 2010 as an HTML5-canvas grapher and picked up 400+ stars over the years. The site ran on a free .tk domain — which turned out to be the fatal flaw: the registrar (Freenom) eventually seized the domain to serve ads on it, and after Meta sued Freenom the whole .tk registry collapsed and the domain stopped resolving entirely.

The lesson was learned and the grapher was rebuilt from scratch — new parser, new CAS, WebGL rendering instead of canvas — on a domain that's actually owned: equation.io. The original code is preserved on the legacy branch (tag graph.tk-final) under its original LGPL-3.0 terms; everything on main is a clean-room rewrite, MIT licensed. The old UI remains usable at graph.equation.io.

Architecture

Deployed as a Cloudflare Worker. The page is web/; the mathematics is lib/.

  • lib/expr.ts is the tokenizer, the shunting-yard parser, and the expression tree. lib/defs.ts resolves names and definitions. Resolve-time expansions live with the mathematics they implement: vector-calculus.ts (gradient, divergence, curl), sums.ts (Σ and Π), and the integral, curve, and surface passes in integrate.ts, curves.ts, and surface-geometry.ts.
  • Distributions are lib/dist.ts. It re-exports base laws (dist-base.ts), continuous sampling (dist-sample.ts), discrete laws (dist-discrete.ts), and the random-variable system (dist-system.ts). The family table is dist-families.ts.
  • Geometry, tensors, measures, lists, and automata make up the rest of lib/: geom.ts, pga.ts, clifford.ts, tensor.ts, measure.ts, list.ts, automaton.ts, and the modules beside them. compiler.ts turns a classified row into a CPU plan and a GLSL plan (glsl.ts).
  • web/main.ts is the equation editor and the boot. web/session.ts owns the document, the panels, and the shared WebGL renderers. web/scene.ts builds one frame and hands it to the 2D and 3D renderers. Mutable state those three share lives on web/app-state.ts.
  • Every equation is compiled to a GLSL scalar field F whose zero set is the graph:
    • 2D: fullscreen-quad fragment shader; the curve is drawn where the distance estimate |F|/|∇F| is under a pixel, with a two-scale consistency test rejecting fake lines at poles/asymptotes (e.g. y=tan(x)).
    • 3D (automatic when z appears): raymarched implicit surface — sign-change detection along each ray, bisection refinement, finite-difference normals, gl_FragDepth so multiple surfaces intersect correctly. Equations without z extrude to their true locus in R³.

The whole graph state lives in the URL (/g/eq1;eq2;…, each equation percent-encoded via lib/link.ts, which also escapes parens so chat-app linkifiers don't truncate the URL; legacy /#… links still load), so any set of equations is linkable and the address bar is the share mechanism. Agent-facing surface:

  • /llms.txt — link format + expression syntax reference (web/public/llms.txt)
  • /g/<eqs> — share form of a graph link; the worker injects og:/twitter: meta tags (the graph's equations as the title, over the site card)
  • /mcp — stateless MCP server (Streamable HTTP) with encode_graph_url (validates rows, returns links), decode_graph_url (decodes links for editing), and show_graph (renders the interactive grapher inside MCP Apps hosts). See MCP Apps integration and testing.
  • /.well-known/ard.json (also at the older /.well-known/ai-catalog.json) — Agentic Resource Discovery catalog listing the MCP server, and /mcp/server-card — its MCP Server Card. Both are generated from server.json by worker/discovery.ts.

Usage

sh
pnpm web        # dev server (grapher + worker API)pnpm test       # vitestpnpm typecheck  # lib + web + workerpnpm web:build  # build to dist-web/ (client + worker)pnpm deploy     # build and deploy to Cloudflare

Traffic and MCP usage

sh
pnpm traffic 7     # needs `wrangler login`

Site visitors come from Cloudflare's own zone analytics. The script counts unique IPs per day on each page, using browser user agents only, and lists /mcp POSTs by client. Nothing on the site collects this.

MCP tool calls are the one thing Cloudflare can't see, because it doesn't record request bodies. worker/mcp-usage.ts writes one Analytics Engine point per tools/call: the tool, the client, the graph types, and row and error counts, never equation text. Set CLOUDFLARE_API_TOKEN, with Account Analytics: Read, for the script to include them.

Examples

Basics

  • y = x^2 · x^2+y^2=4 · y = tan(x) — 2D curves
  • y = sin(2πx) · θ = 1; r = θ x · y = x³ — unicode input: π, Greek-letter names, superscript exponents, subscripts (T₀ ≡ T_0, so a₃ is a sequence term), and ·/×/÷/≤/≥/≠; in the editor, typing \pi, \theta, \nabla, … inserts the symbol, and \ before any function name just drops (\trail → trail)
  • z = sin(x)cos(y) · x^2+y^2+z^2=9 — 3D surfaces (automatic when z appears)
  • y < x/2 + 1 — inequalities shade their region; strict </> have no border, <=/>= draw the boundary line, and chains like 4 <= x^2 + y^2 <= 9 intersect with an edge per non-strict bound
  • y = {x < 0: -x, x >= 0: x^2} — piecewise: cond: value cases tried in order, an optional last bare value is the default; conditions chain like {0 < x < 1: 1, 0}, and a bare condition counts 1 ({x > 0, 5})
  • y = {0 < x < 2: x^2} — a domain restriction: with no default, the value is undefined outside the conditions, so nothing is drawn there
  • sin(x)cos(y) — a bare expression in x, y is a 2D scalar field, shaded in the row color where positive and its complement where negative. sin(x) is a field too (constant along y): the curve is y = sin(x)
  • 2+2, sqrt(a), |A - B| — a bare number draws nothing and reads out = 4 under the row, live with sliders and t; write y = 4 for the line

Sliders and animation

  • a = 2 — a named constant with a slider; other equations can use a, and it compiles to a uniform so dragging never rebuilds a shader. b = a^2 + t defines a computed/animated constant
  • a := 2, f(x) := x^2 — the same definitions written explicitly. := can also take over e, pi, i, w or t as a value (not a function) for the whole graph (e := 0.6 is a slider; t := 0.5 stops all animation); u and v take an interval (u := interval(0, 2pi)); x, y, z and d stay the language's
  • (2, 3) / (3, 12, 0) — points. In 2D, coordinates that are plain numbers or slider names can be dragged on the canvas, and the drag rewrites them: a = 1; b = 2; (a, b) moves both sliders, (2sin(t), 3) only its literal height
  • (2cos(t), 2sin(t)) — t is seconds since load, so this point orbits

Calculus

  • f(x) = x^3 - a x — user-defined functions, inlined symbolically
  • f(z) = {re(z) >= 1: 1, f(4 - 3(z^6)^(1/6))} then f(x i - |y|) >= 0 — a tail-recursive function (every self-call a whole case of its {…}) runs as a bounded loop per pixel; this one shades the Koch snowflake
  • y = d/dx f(x) / d^2/dx^2 (x^4) — symbolic Leibniz derivatives; works for any single-letter variable, nests, and flows through function definitions: g(x) = d/dx f(x) then y = f(a) + g(a)(x - a) is a live tangent line

Probability

  • X ~ Normal(0, a) — a random variable; the row plots its density, and parameters may use sliders. Then P(X < b), P(X > b), or P(-1 < X < 2) shades that area under the density and shows the numeric probability
  • Also Uniform(lo, hi), Exponential(rate), Gamma(shape, rate), Beta(a, b), ChiSquared(df), StudentT(df) (or T(5)), LogNormal(mu, sigma), Cauchy(location, scale), Weibull(shape, scale) — exact densities, exact P(…), and median/IQR readouts where heavy tails leave no σ to report
  • erf, normalpdf(x, mean, sd), and normalcdf(x, mean, sd) are also plain functions, so y = normalcdf(x, 0, 1) graphs the CDF

Vector fields and ODEs

  • (-y, x) — a tuple depending on x, y is a vector field, rendered as animated streamlines via GPU line-integral convolution; t works too: (cos(t)-y, x)
  • grad(x^2 + y^2) (or ∇(…)) — the symbolic gradient as a tuple, so it plots as a vector field and works in dot(grad(f), (1, 0))
  • dy/dx = x y / y' = sin(x) - y — ODEs plot the slope/direction field (1, f); click the canvas to drop an RK4 integral curve through that point, double-click to clear
  • (x', y') = (y, -sin(x)) — a system plots its phase portrait, with the same click-to-trace trajectories

Simulation (states)

  • th' = om (angle) with om' = -sin(th) (angular velocity) and th(0) = 3 — a state: a prime on a name of your own is d/dt of it, integrated forward by RK4 at a fixed step as the graph animates — see lib/state.ts. Everywhere else th behaves exactly like a constant, uniform and all, so drawing the system is ordinary plotting: (sin(th), -cos(th)) is the bob, (u sin(th), -u cos(th)) the rod. It is the one value in a graph that is not a formula in t, which is what makes a double pendulum — chaotic, no closed form — possible. Initial values get a slider that relaunches the run; ↻ in the panel restarts it
  • r' = vel with vel' = -r/|r|^3 and r(0) = (1, 0) — a vector state: a derivative that is a 2- or 3-vector integrates componentwise as r_1, r_2(, r_3), and the bare name draws as a moving point and joins point arithmetic — an orbit in two rows
  • label((2, 4), "peak") / label(A, "vertex") — text beside a point, in the row's color; the point follows sliders and t like any other
  • y = x^2 #e24 — a note that opens with a hex color draws the row in it
  • trail(A) — leaves a live motion trail behind a 2D or 3D point. For example, A = (cos(t), sin(t)); trail(A) draws an orbit as it runs; trail((cos(t), sin(t), t/5)) draws a rising helix. Vector states work too. Trails retain up to 30 seconds / 2048 observed positions, reset when the equations or simulation restart, and are local to the current session.
  • p(0) = ([0..299]/30, 0, 0) — a state family: a list of starting values runs the system once per element (up to 1024), and states coupled to it run along. p then draws a cloud of moving points and mean(p_1) reduces across runs. Started from a tuple, p(0) = (sort([0..299])/30, 0, 0), the runs are in order and p[1] is the first
  • p(50..400) — an orbit: where the state goes between those times, integrated ahead of time with the live simulation's own steps (lib/orbit.ts), so moving points ride their orbit. A family draws one path per run (p[1](50..400) draws one, when the runs start from a tuple); a scalar state plots against time, th(0..20) being the curve (t, th). With both, the Rössler attractor is a thin band of orbit with particles flowing along it

Custom coordinates and complex roots

  • r = sqrt(x^2+y^2); theta = atan2(y,x) defines polar coordinates. (r, theta) = (2, 9pi/4) draws their point, with angles wrapping modulo 2π. Use literal or slider values on the right to drag the point in those coordinates.
  • (r, theta) = (3u, 6pi u) traces a three-turn spiral; (r', theta') = (r(1-r), 1) draws a polar limit-cycle field.
  • 1+2i draws an Argand point; w^3 = 1 draws the three cube roots of unity. Systems use a numerical search in the current view; small solution branches may be missed. Coordinate examples are available in the examples menu.

Matrices

  • M = ((a, b), (c, d)) — a tuple of rows is a 2×2 or 3×3 matrix (a bracket of tuples, [(a, b), (c, d)], is two points); det(M), trace(M), the matvec M v, and solve(M, v) (Cramer's rule) expand symbolically at lowering time, see lib/mat.ts. So (x', y') = A (x, y) is a phase portrait with sliders in the entries, and om' = solve(M, f) integrates the double pendulum in the Lagrangian form M(θ)ω′ = f it is derived in

Parametric curves and surfaces

  • (2cos(2pi u), 2sin(2pi u), 3u) — parametric curve, u ∈ (0,1)
  • u^2 — a bare row in u, v alone draws its values: the density of u² for u uniform on [0, 1]
  • (cos(2pi u)(2+cos(2pi v)), sin(2pi u)(2+cos(2pi v)), sin(2pi v)) — parametric surface, u,v ∈ (0,1); per-fragment Newton ray/surface intersection with a glossy specular material

Sequences and data

  • a_n = 1/n^2 — a sequence: dots at integer n ≥ 0; the Σ toggle on the row switches to partial sums S_N (this one converges to π²/6)
  • a_{n+1} = r a_n (1 - a_n) — a recurrence: draws the map's curve, the diagonal y = x, and the cobweb path from the seed a_0 (define a_0 = 0.2 for a slider, default ½). With x free on the right side, x becomes the parameter axis and the plot is the orbit/bifurcation diagram: a_{n+1} = x a_n (1 - a_n) is the logistic bifurcation
  • [3, 1, 4, 1, 5] — a data list: a dot plot on the number line, each value at x = value with its copies stacked (1 twice: dots at (1, 1) and (1, 2)). [(1, 2), (3, 4)] is a scatter of points

Regression

  • P = [(0, 1), (1, 3), (2, 5), (3, 7)]; P.y ~ m P.x + b fits a line through the points. P.x and P.y are the lists of their coordinates, paired point by point like a data file's columns (two separately written lists X, Y are independent, so (X, Y) would be their grid). Unbound names m and b become fitted constants; y = m x + b draws the model and (P.x, P.y - (m P.x + b)) draws its residuals. A fit row reports the coefficients, RMSE, R² (when defined), and observation count.
  • P.y ~ a P.x^2 + b P.x + c fits a polynomial; P.y ~ a exp(b P.x) fits a nonlinear model. Already defined constants stay fixed and changing them refits the other coefficients. Define data and fixed constants above the fit.
  • data.height ~ m data.age + b works with CSV columns. Missing/nonfinite data pairs are skipped with a count; mismatched lengths and unidentifiable coefficients are errors. Missing CSVs remain device-local in shared links.
  • Fits are static, with at most 8 coefficients and 10,000 observations (2,000 for nonlinear models). Nonlinear fitting uses deterministic starts and reports a local fit; it does not guarantee a global optimum.

Fourier analysis

  • s = interval(0, 1); fourier(cos(4pi s) + 0.5sin(10pi s)) — a one-sided amplitude spectrum. The interval is the signal's variable and its period, so frequency is in cycles per unit of it; a function reads over one as fourier(f(s)). 256 samples by default; fourier(f(s), 512) sets them.
  • N = clamp(round(5), 0, 48); y = reconstruct(f(s), N) — the signed mean plus the first N harmonics, preserving phase. An optional sample count follows N. The Fourier analysis examples show the original, spectrum and reconstruction in linked views.
  • S = sort(data.signal, data.row); fourier(S) — equally spaced CSV samples in file order, spanning [0, 1) or fourier(S, interval(0, 10)). Tuples work too, fourier((0, 1, 0, -1)); bracket lists have no order. Samples must be finite real numbers, with no gaps. Both operations assume periodic continuation and static signals; coefficients recompute when signal sliders change. Reconstruction supports up to 128 harmonics; sample counts range from 2 to 4096.

Contextual syntax help

The equation editor suggests functions, defined names, and loaded CSV columns as you type, and shows signatures inside function calls. Tab or a click inserts a suggestion; arrow keys select one for Enter to insert. Enter otherwise creates an equation row, Escape dismisses help, and completion is one undoable text edit. Comments and quoted strings do not trigger suggestions.

Number theory and complex analysis

  • gcd(a, b) / isprime(n) — number theory; try a_n = isprime(n)
  • ln(w-2) - ln(w+2) — complex analysis: i is the imaginary unit and w = x + iy; a complex-valued expression renders the level curves of its imaginary part (field lines) and real part (equipotentials), so complex potentials draw electrostatics directly. re/im/arg/abs/conj bring values back to ℝ, e.g. im(ln(w)) = 1 plots as an ordinary implicit curve

Equations persist in the URL hash. Drag to pan/orbit, wheel to zoom, right-drag (or shift) to pan in 3D, click a color dot to cycle colors. Points and dropped ODE seeds highlight under the cursor and drag with it. The equations panel is a corner-pinned card: flick it — touch anywhere on it, or drag the grip strip along its top edge with a mouse — to send it to any corner, or throw it past any edge to clear the view entirely; it tracks the pointer and leaves along the throw. The y= chip left behind brings it back (tap it, or drag it to pull the panel in), and the chosen corner sticks.

worker/ — the Cloudflare Worker entry: serves the built app and handles /api/* routes.

Contributing

You need Node 24 and pnpm. Run pnpm install, then pnpm web for the dev server. Before opening a PR, run the same checks CI runs:

sh
pnpm typecheck    # tsc over lib, web and workerpnpm lint         # Oxlint, including type-aware rulespnpm fmt:check    # Oxfmt (pnpm fmt rewrites files in place)pnpm vitest run   # unit tests

pnpm lint:fix applies the fixes Oxlint can make automatically. In VS Code, install the recommended Oxc extension to see lint errors as you type.

License

MIT — see LICENSE. The pre-2026 graph.tk code on the legacy branch remains under its original LGPL-3.0 terms; no code from it was reused in the current codebase.

Axis scaling

Option/Alt + drag the 2D canvas to scale each axis independently: horizontal movement scales x and vertical movement scales y, anchored at the initial pointer position. Normal zoom preserves the ratio. Set ratio = 1 in the viewport row to restore equal axis units.

Scaling creates or updates a shareable viewport row: view(x = -10..10, y = -1..1, ratio = 5). The positive ratio is pixels per y unit divided by pixels per x unit; omitted means 1. The bounds are fitted with that ratio preserved, including on different screen sizes.

來源:README.md,提交 0ae70ef

工具

3

encode_graph_url

Create a graph link

Build an equation.io graph link, validating every row with the app's parser. Pass the COMPLETE graph in "equations": a flat array of strings, one equation or definition per string, in display order — when editing an existing graph (see decode_graph_url), include unchanged rows too. Rows can be: equations and inequalities in x,y (curves, regions; z makes it 3D), bare expressions in x, y (scalar fields — a curve is written y = f(x); complex plots via w), points (rows report "draggable"), parametric tuples in u,v — and definitions: "a = 2" (a draggable slider), "f(x) = x^3 - a x", coordinate fields like "r = sqrt(x^2+y^2)" for polar. t animates. Also derivatives d/dx, integrals int[a..b] f dx, sums sum[n=1..N], domain()/conformal()/iter() for complex plots, rgb()/hsl()/oklch() color fields, y' = … slope fields, random variables "X ~ Normal(m, s)"/"P(0<X<2)"/"E(X^2)", and "view(x = -5..5, y = -2..2)"/"camera(theta, phi)" framing rows. That is a menu, not the syntax: before your first non-trivial graph, read the "syntax" MCP resource (also at https://equation.io/llms.txt). The result returns text and structured data only. "rows" gives each equation's validation result: status "ok" with its kind, or "error" with the parser message. The link is usable only once every row is "ok". Give users the share_url (it unfurls to a link card in chat apps); url is the equivalent #-fragment form. No image is attached to the tool response.

輸入參數equations必填

decode_graph_url

Read a graph link

Decode an equation.io link (either the #-fragment form or the /g/ share form) into its list of equation rows, so you can edit them and build a new link with encode_graph_url. The rows use the equation.io syntax documented in the "syntax" MCP resource (also at https://equation.io/llms.txt).

輸入參數url必填

show_graph

Show an interactive graph

Display an interactive equation.io graph inside the conversation, with editable equations, sliders, pan/zoom, and 3D rotation. Use when the user asks to see or explore a graph. Pass the COMPLETE graph as "equations", one equation or definition per string, preserving unchanged rows when editing. For a slider use "a = 2" then "y = a sin(x)". For advanced syntax read the "syntax" resource (https://equation.io/llms.txt). Returns per-row validation and share links; a row with status "error" is not drawn until its text is corrected and the graph resubmitted. Use encode_graph_url for validation or link-only requests (including share-link preview notes). In clients without UI support, provide share_url.

輸入參數equations必填

版本歷史

2
  1. v1.0.1最新Oct 2, 2026
  2. v1.0.0Sep 16, 2026

評分

已滿足適用檢查項的 100%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分