Skip to content
DoingCamp CS

Make it comfy

Lesson style

Quick mode shows the key picture, a summary and the practice. Good for a refresher.

Theme
Font

Both fonts are designed to be easy to read. Some readers with dyslexia prefer Lexend.

Text size
Spacing
Animations

Lesson 1 of 20 · about 14 min

Rates of change

Welcome to Splash Park, where you're the only programmer and the new slide, the Big Drop, opens in a month. How fast does a rider fall? How quickly does the new pool fill? Both questions are about rates of change. You'll measure them as the slope of a line between two points on a graph, the idea that all of calculus grows out of.

🧭 What you need first: Functions

The story

Splash Park is opening a new slide this summer, the Big Drop. Riders stand on a platform 12 m up, the floor opens, and for the first stretch they fall almost straight down. You’re the park’s only programmer, and over this course you’ll write the software the park needs: the speed display, the pool-filling schedule, the wave machine, and finally a model that predicts queue times.

The ride’s engineers gave you a formula. Ignoring air and water friction, a rider’s height tt seconds after the floor opens is

h(t)=12−4.9t2 metersh(t) = 12 - 4.9t^2 \text{ meters}

(The 4.9 is half of 9.8 m/s², the pull of gravity.) After 1 second the rider is at 12−4.9=7.112 - 4.9 = 7.1 m. The manager asks: how fast are they going? That’s a question about a rate of change, and answering it properly is what calculus is for.

Another way: a road trip

You drive 150 km in 2 hours. Your average speed is 150 ÷ 2 = 75 km/h, even though the speedometer said 0 at red lights and 110 on the motorway. An average rate only needs two snapshots: where you were, and when.

Play with it

Measure the fall

The graph shows the rider’s height over time; the tower on the right shows where they are. Pick a start time a and a gap h, and read off the average speed between them.

Is the rider's average speed in the first half-second the same as in the next half-second?

🎯 1/3: Find the average rate of change of height over the first full second (a = 0, h = 1).

Slide the start a and the gap h. The purple line joins the two orange points; its slope is the average rate of change between them.

h(t) = 12 − 4.9t²

from 0 to 0.5: Δ = −1.225 over 0.5

average rate = −1.225 ÷ 0.5 = −2.45 m/s

The minus sign means the height is going down. As a speed (always positive), the rider averages 4.9 m/s in the first second, then 9.8 m/s from 0.5 s to 1.5 s, then 12.25 m/s in the last half-second shown: faster and faster.

Fill the new pool

The park’s new wave pool holds 450 m³. The pump pushes hard at first, then slows as the pool fills: after tt hours it holds V(t)=450(1−e−t/4)V(t) = 450(1 - e^{-t/4}) cubic meters. (You’ll meet ee properly in lesson 6.)

🎯 1/2: What is the average filling rate over the first 4 hours?

Slide the start a and the gap h. The purple line joins the two orange points; its slope is the average rate of change between them.

V(t) = 450(1 − e^(−t/4))

from 0 to 2: Δ = 177.061 over 2

average rate = 177.061 ÷ 2 = 88.531 m³/h

Name it

The real words

  • The Average rate of change of ff from aa to bb is

    ΔyΔx=f(b)−f(a)b−a\frac{\Delta y}{\Delta x} = \frac{f(b) - f(a)}{b - a}

    The Greek letter Δ\Delta (delta) means “change in”.

  • Geometrically, it’s the slope of the Secant line, the straight line through the points (a,f(a))(a, f(a)) and (b,f(b))(b, f(b)). Steeper secant, faster change.

  • Units always come along: height in meters divided by time in seconds gives m/s; volume in m³ divided by hours gives m³/h.

  • Signs: positive means increasing, negative means decreasing, zero means “no net change” (it might have gone up and back down in between).

  • The limitation: an average rate depends on the whole interval. It can’t say how fast the rider is going at exactly t=1t = 1. To get that, we’ll shrink the interval toward zero, which needs the idea of a limit (lesson 2) and leads to the derivative (lesson 3).

Build it

Average rates in code

Write h(t) = 12 − 4.9t² for the Big Drop, then average_rate(f, a, b) = (f(b) − f(a)) / (b − a) for any function f. Functions can be passed around like any other value.

Challenge

Read the ride sensor

On test day, a laser sensor on the tower measures the rider’s height every 0.25 seconds. The log is a list of (time, height) pairs.

Write speeds(log): for each pair of neighbouring readings, the average speed between them as a positive number in m/s (absolute value of the average rate), in order. Then speed_ups(log): how much each speed is bigger than the one before it. Divide those by 0.25 s and you get the acceleration.

The speed goes up by exactly the same amount every quarter-second: 9.8 meters per second, every second. That’s a rate of change of a rate of change, and it’s the acceleration of gravity. You’ve just met a second derivative (lesson 8) without the name.

Remember it

The pool held 284 m³ after 4 hours and 389 m³ after 8 hours. What was the average filling rate between those times?

Got it?

Finish the lesson to color it in on your map and collect its concept cards.

Did this lesson click?