A function of two inputs (position east/west and north/south) that outputs one number: the ground height at that spot.
Algebra-to-calculus extension · 60-minute interactive lesson
Modeling Minecraft-like terrain with calculus
Build a simplified terrain model from layered functions. Then use slope to predict where water would move on that model. Minecraft uses noise-based world generation, but this classroom simulation is not a reproduction of its terrain or fluid algorithms.
Model boundary: the sine waves and downhill flow here are teaching tools. Minecraft's 1.18 release notes describe noise caves and world-generation changes.
Terrain as a function
Our model assigns a height to each (x, z) position. Real game terrain also has caves, overhangs, and other features that a single height value cannot describe.
We use a smoothly changing height function so we can discuss its slope. Real terrain can include abrupt edges, and a continuous function need not have a derivative at every point.
The "randomness" in a Minecraft world is actually a fixed function of the seed and coordinates — plug in the same numbers and you always get the same mountain.
Think of it like a giant spreadsheet: column A is x, column B is y (called z in-game), and column C is a formula that computes height from A and B. Missions 2–4 build that formula from scratch.
📜 History Files: from graph paper to procedural worlds
Stacking waves into mountains
A single sine wave looks like ripples, not mountains. Add several waves of different frequency and height together — "octaves" — and you get a believable landscape profile.
The formula: height(x) = Σ amplitudei · sin(frequencyi · x + phasei) — this sum-of-waves idea is the same one behind Fourier series (see the related lab below). Each new octave roughly doubles the frequency and halves the amplitude, adding fine detail without erasing the big shape.
Slope, gradient & the derivative
The steepness of a hill at any point is literally the derivative of the height function. In two dimensions, the full "which way is steepest" answer is called the gradient.
df/dx tells you the slope of a 1D curve at a point — rise over run as the run shrinks toward zero.
For a hill f(x, y), the gradient is a vector pointing in the direction of steepest uphill climb, with a length equal to how steep that climb is.
Walking in the exact opposite direction of the gradient, −∇f, is the fastest way downhill — precisely how water finds its path in Mission 4.
Hover or tap anywhere on the terrain map below. The computer can't take a perfect symbolic derivative of noisy terrain, so it does what engineers do in practice: a finite-difference approximation, nudging x and y by a tiny step h and measuring how much height changes — ∂f/∂x ≈ (f(x+h,y) − f(x,y)) / h.
Water flow & steepest descent
In this simplified simulation, water follows a lower neighboring position. Compare that discrete rule with the continuous gradient of a height function; it does not describe Minecraft's fluid algorithm.
Real-world version: gravity accelerates real water down the true gradient continuously, but the "always move toward the locally lowest spot" rule is such a good approximation that it is also how erosion-simulation software and machine-learning training (gradient descent) both work — same math, three very different uses.