Click once. Understand forever.
50 interactive simulations that make math click โ no math degree required.
50 interactive HTML simulations (41 experiments + 9 simulators) for learning Constraint Theory, geometry, physics, and math. Built for students, teachers, and the perpetually curious.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ ๐ Reading docs: "The manifold consists of..." โ
โ (2 minutes later) "Wait, what?" โ
โ โ
โ ๐ฑ๏ธ Interactive demo: Click canvas โ See snap โ Got it! โ
โ (5 seconds to understanding) โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โก Zero setup. Zero build. Zero friction.
| I want to... | Click here |
|---|---|
| See geometry snap | Pythagorean Demo โ |
| Watch algorithms work | KD-Tree Demo โ |
| Play with physics | Swarm Demo โ |
| Browse all 50 | Full Gallery โ |
๐ป Prefer local? Clone it (optional)
git clone https://github.com/SuperInstance/constraint-theory-web.git
cd constraint-theory-web
open simulators/pythagorean/index.html # That's it. No npm install.Reading about Pythagorean snapping:
"The manifold consists of integer-ratio points on Sยน indexed by KD-tree with O(log n) lookup..."
...interesting, but what does it actually look like?
Opening our demo:
Click anywhere on the canvas. Watch your cursor snap to the nearest exact coordinate. See the noise. Understand instantly.
| Demo | What You'll Learn | Seconds to Try |
|---|---|---|
| Pythagorean Snapping | Click to snap โ see noise in real-time | โถ Play |
| KD-Tree Visualization | Watch O(log n) in action | โถ Play |
| Swarm Behavior | Boids with deterministic physics | โถ Play |
| Demo | What You'll See | Quick Link |
|---|---|---|
| Mandelbrot Set | Fractal zoom with color cycling | โถ |
| Fourier Series | Circles drawing waves | โถ |
| Geometric Algebra | Clifford algebra made visual | โถ |
| Holonomy Transport | Parallel transport on manifolds | โถ |
| Quaternion | 4D rotations projected | โถ |
| Complex Plane | Mรถbius transforms | โถ |
| Cellular Automata | Conway's Life & more | โถ |
| Demo | What You'll Experience |
|---|---|
| N-Body | Gravitational chaos โ watch planets orbit |
| Fluid Dynamics | Navier-Stokes in your browser |
| Soft Body | XPBD constraint solver โ squishy physics |
| Wave Interference | Constructive & destructive patterns |
| Voxel XPBD | 3D physics engine |
| Demo | What You'll Explore |
|---|---|
| Neural Network | Forward pass visualization |
| Tree of Thoughts | AI reasoning visualization |
| Constraint Network | Agent coordination |
Want to build your own? Here's a minimal starting point:
๐ Show me the code
<!DOCTYPE html>
<html>
<head>
<title>My First Constraint Demo</title>
<style>
canvas { border: 1px solid #333; cursor: crosshair; }
#info { font-family: monospace; margin-top: 10px; }
</style>
</head>
<body>
<canvas id="demo" width="400" height="400"></canvas>
<div id="info">Click anywhere to snap to nearest Pythagorean triple</div>
<script>
const canvas = document.getElementById('demo');
const ctx = canvas.getContext('2d');
const info = document.getElementById('info');
const triples = [
[3/5, 4/5], [4/5, 3/5], [5/13, 12/13], [8/17, 15/17], [7/25, 24/25]
];
canvas.addEventListener('click', (e) => {
const rect = canvas.getBoundingClientRect();
const x = (e.clientX - rect.left) / 200 - 1;
const y = (e.clientY - rect.top) / 200 - 1;
let best = triples[0], minDist = Infinity;
for (const [tx, ty] of triples) {
const dist = Math.hypot(x - tx, y - ty);
if (dist < minDist) { minDist = dist; best = [tx, ty]; }
}
ctx.clearRect(0, 0, 400, 400);
ctx.beginPath();
ctx.arc(200 + x * 200, 200 + y * 200, 5, 0, Math.PI * 2);
ctx.fillStyle = 'red';
ctx.fill();
ctx.beginPath();
ctx.arc(200 + best[0] * 200, 200 + best[1] * 200, 8, 0, Math.PI * 2);
ctx.fillStyle = 'green';
ctx.fill();
info.textContent = `Snapped to (${best[0].toFixed(4)}, ${best[1].toFixed(4)}) - noise: ${minDist.toFixed(4)}`;
});
</script>
</body>
</html>Copy-paste into a .html file, open in browser, and click!
โ See contributing guide for more
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Want to SEE math, not read it?โ
โโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ โ
โโโโโโผโโโโโ โโโโโโผโโโโโ โโโโโโผโโโโโ
โ TEACHER โ โ STUDENT โ โ DEV โ
โโโโโโฌโโโโโ โโโโโโฌโโโโโ โโโโโโฌโโโโโ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ
โ โ Use โ โ โ Learn โ โ โ Debug โ
โ in classโ โ by doing โ โ your codeโ
โโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ
If any of these sound like you, you're in the right place.
Kinesthetic learning beats lecture. Students remember what they discover.
// In class: Open Pythagorean demo
// Students click around the unit circle
// They see which points snap to exact values
// Patterns emerge: (3,4,5), (5,12,13), (8,15,17)...
// No lecture needed โ they get it.Struggling with a concept? Stop reading. Start clicking.
- Fourier Series โ Watch circles draw waves
- Mandelbrot โ Zoom into infinity
- Swarm โ See emergence in action
Visual debugging catches what unit tests miss.
- KD-Tree โ Watch queries traverse partitions
- N-Body โ Validate your physics engine
- Constraint Network โ Debug agent coordination
- Zero dependencies โ Vanilla JavaScript
- Canvas 2D / WebGL โ Hardware-accelerated rendering
- Responsive โ Desktop and mobile friendly
- Self-contained โ Single HTML file per demo
- Accessible โ ARIA attributes, keyboard navigation, screen reader support
| Browser | Version | Status |
|---|---|---|
| Chrome | 90+ | โ Full support |
| Firefox | 88+ | โ Full support |
| Safari | 14+ | โ Full support |
| Edge | 90+ | โ Full support |
| Mobile Safari | 14+ | โ Touch optimized |
| Chrome Mobile | 90+ | โ Touch optimized |
| Repo | What It Does | Key Features |
|---|---|---|
| constraint-theory-core | ๐ฆ Rust crate | ~100ns snap, SIMD batch, 82 tests |
| constraint-theory-python | ๐ Python bindings | NumPy integration, PyTorch compatible |
| constraint-theory-web | ๐ This repo | 50 visualizations, zero setup |
| constraint-theory-research | ๐ Mathematical foundations | arXiv paper, proofs, open problems |
| constraint-ranch | ๐ฎ Gamified learning | Puzzle games, agent breeding |
| constraint-flow | ๐ผ Business automation | Exact financial calculations, workflow orchestration |
| constraint-theory-agent | ๐ค Implementation agent | Code audit, refactoring, expert explanations |
Use Constraint Theory in the browser with WebAssembly:
// Install from npm (when published)
// npm install constraint-theory-wasm
// Or build from source
git clone https://github.com/SuperInstance/constraint-theory-core
cd constraint-theory-core
wasm-pack build --target web --out-dir ../constraint-theory-web/wasm
// Use in JavaScript
import init, { PythagoreanManifold } from './wasm/constraint_theory_core.js';
await init();
const manifold = new PythagoreanManifold(200);
const [exact, noise] = manifold.snap([0.577, 0.816]);
// exact = [0.6, 0.8] โ forever exact!Cite our work in your papers:
@article{constraint_theory_2025,
title={Constraint Theory: Deterministic Manifold Snapping via Pythagorean Geometry},
author={SuperInstance},
journal={arXiv preprint arXiv:2503.15847},
year={2025},
url={https://github.com/SuperInstance/constraint-theory-research}
}Key papers:
- Mathematical Foundations โ 45-page deep dive
- Theoretical Guarantees โ Zero-hallucination proofs
- arXiv:2503.15847 โ Publication-ready PDF
For journalists, influencers, and community outreach:
- HN Title Options โ Tested variations
- HN FAQ โ Prepared responses
- HN Comment โ Draft first comment
npm install -g wrangler
wrangler pages deploy . --project-name constraint-theory-webGood First Issues ยท CONTRIBUTING.md
We welcome:
- ๐จ New demos โ Add your visualization
- ๐ Translations โ Make it global
- ๐ฑ Mobile improvements โ Touch support, responsive design
MIT โ see LICENSE.