Philosophy & Mission

About CodeByMath

CodeByMath was created as an interactive space where learners can write simple computer programs in the context of exploring mathematics.

CodeByMath was created as an interactive space where learners can explore mathematics in the context of writing simple computer programs.

Core Principle

"The separation of computer science from mathematics greatly impoverishes both."

Alexander A. Stepanov Elements of Programming

Why This Site?

Three central ideas drove the creation of CodeByMath:

1
Beyond Digital Media

In today's machine-driven society, students must learn to use computers for more than consuming digital media. Whether in science, engineering, business, or the arts, genuine progress requires programming—and that programming is inherently rooted in the logic and structure of mathematics.

2
Instant-Response Coding

Modern operating systems and complex development environments (IDEs, compilers, terminals) overwhelm beginners. We grew up programming the first home computers, like the TRS-80: turn it on, type a command, and get instant feedback.

Type circle(0,0,5) and see a circle drawn on the screen instantly. Add line(0,80,0,-30) and you're already coding a stick figure.

3
Math as Real Context

Programming often feels abstract without an authentic problem to solve, while math can feel dry without an active sandbox. At CodeByMath, coding provides a hands-on playground to discover π, test Pythagorean triples, explore acoustic beats, or verify trigonometry identities.

Interactive Mathematical Discovery

From First Moves to Advanced Simulation

Our curriculum spans pre-algebra through calculus, physics, and computer science. Every lesson is interactive, self-paced, and executed 100% in-browser using WebAssembly:

  • Geometry & 3D Modeling: 3D Rubik's Cube with orbital mouse controls, 2D shapes, and 3D STL file exports.
  • Acoustics & Fourier Harmonics: Synthesize instrument timbres, musical scales, and acoustic interference beats.
  • Physics & Game Engines: Rigid body simulations with Matter.js, trajectory physics, and gravity.
  • Real-World Hardware: Connect to sensor inputs and convert temperature with an Arduino with live data.
Browse Full Curriculum Catalog →
Sample Classroom Experience
-- Discover circle circumference
radius = 14
circumference = 2 * math.pi * radius
print("Circumference:", circumference)
circle(0, 0, radius)
✓ Instant WebAssembly Run Done in 0.002s

Under the Hood: Modern Web Technologies

CodeByMath is built on open standards, blending high-performance client-side WebAssembly with modern web graphics and audio APIs:

Lua
Primary Language

Chosen for its minimal punctuation, clean syntax, and mathematical clarity. Perfect for beginners transitioning to algorithmic thinking.

WebAssembly (Wasm)
Client-Side Engine

Executes student Lua code directly in the browser via dedicated Web Workers with a 4-second watchdog timer against infinite loops.

3D Graphics & Cubing
Three.js & cubing.js

Powers our 3D Rubik's Cube visualization, orbital camera controls, animated turn sequences, and interactive 3D geometry models.

Web Audio & Physics
Web Audio & Matter.js

Synthesizes pure tones, Fourier harmonics, and acoustic beats in real time, with Matter.js simulating 2D rigid-body collision physics.

CodeMirror
In-Browser Editor

In-browser code editor with line numbering, dynamic font resizing, bracket matching, and Lua syntax highlighting.

Tau-Prolog
Logic Programming

Client-side Prolog interpreter allowing students to explore declarative logic programming directly in the sandbox.

GiNaC & MathJax
Symbolic Math

Powers symbolic algebra verification and crisp mathematical formula typesetting across all lesson tutorials.

Backend & Security
PHP & MySQL

Lightweight CodeIgniter backend handling secure bcrypt user authentication, learning group rosters, and gradebook exports.

We'd Love to Hear From You

Have an idea for a math lesson? Found a bug? Using CodeByMath in your school or homeschool curriculum? Let us know! Please email Tom Bensky directly at tbensky@gmail.com.