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.

Big idea: a height function f(x, y) describes a surface; its gradient describes the direction of steepest increase.

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.

10 minutesTerrain is a function
15 minutesStacking waves into mountains
15 minutesSlope, gradient & the derivative
20 minutesWater flow & steepest descent
1

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.

📈 f(x, y)

A function of two inputs (position east/west and north/south) that outputs one number: the ground height at that spot.

🌊 Smooth model

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.

🎲 Deterministic randomness

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
1687 · Newton & Leibniz formalize calculusCalculus gave mathematicians tools to describe smoothly changing quantities — exactly the kind of continuous surface a landscape is — and to find the rate of change (the derivative) at any point.
1980s · Procedural noiseKen Perlin's work helped computer graphics produce natural-looking variation from mathematical functions.
Minecraft · Noise-based world generationThe game's documented noise caves show one use of procedural noise. The waves in this lesson are a simpler model for exploring related mathematical ideas.
2

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.

One octave = one gentle wave. Slide up to see mountains gain sharp ridges and small bumps at the same time.
3

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.

📐 Derivative

df/dx tells you the slope of a 1D curve at a point — rise over run as the run shrinks toward zero.

🧭 Gradient (∇f)

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.

🔻 Steepest descent

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.

Move your pointer over the map to sample the height function at that (x, y). f(x, y) = ?
The yellow arrow is −∇f: the direction a marble (or a drop of water) would start rolling if placed at your cursor. Longer arrow = steeper slope = faster acceleration downhill.
4

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.

Click anywhere on the terrain to drop water. It will step toward the steepest downhill neighbor until it reaches a local minimum (a lake bed) or the edge of the map.
Droplets placed: 0 · Pooled in a basin: 0
📜 History Files: gradient descent beyond water
Erosion algorithmsGame and film studios simulate millions of virtual raindrops using this exact steepest-descent rule to carve realistic river valleys into procedural terrain before an artist ever touches it.
Training neural networks"Gradient descent," the core algorithm that trains most modern AI, takes tiny steps in the direction of −∇(error) — mathematically the same move as a droplet rolling downhill toward a valley, except the "landscape" is a model's error instead of elevation.