
Narrow gauge railways — engineering on steep gradients.
The Smallest Engine
On a narrow-gauge track that wound through the hills of Northeast India like a ribbon dropped by a careless cloud, there ran a little train named Bogi. Bogi was old. Her boiler was patched in fourteen places. Her whistle had a crack in it that made her sound like a teakettle with a cold. Her wheels were so small that children on bicycles could keep up with her on the straight bits.
But Bogi didn't care about any of that. She had a job — to carry people and mail and chickens and sometimes a goat from the town at the bottom of the hills to the village at the top — and she did it every single day, rain or shine, monsoon or winter.
"I am the hill train," Bogi would say to herself as she puffed up the steep gradient. "I go where the big trains can't."
The New Express
One day, a gleaming new express train arrived at the junction station. She was enormous — twenty coaches long, sleek as a silver fish, powered by a diesel engine that hummed instead of coughed. Her name was painted in bright letters on her side: NORTHEAST EXPRESS.
"Who is that?" puffed Bogi, staring from her siding.
"That," said the stationmaster, not looking up from his ledger, "is your replacement. The government says narrow-gauge is too slow. They're building a broad-gauge line through the hills. The Express will do your route in two hours instead of eight."
Bogi felt her boiler go cold. "But... the hills are my route. I've been running it for fifty years."
"Progress," said the stationmaster, and shrugged.
The Route Nobody Wanted
The broad-gauge line was built. It punched through the hills with tunnels and viaducts, cutting straight where Bogi had always curved. The Northeast Express roared through in two hours flat, carrying hundreds of passengers in air-conditioned comfort.
Bogi was parked on a rusty siding. Her fire was let out. Weeds grew between her wheels. Birds nested in her funnel. For a year, she sat there, forgotten.
But something strange happened. The new Express didn't stop at the small villages — the tiny hamlets clinging to the hillsides where a dozen families lived, where children needed to get to school and grandmothers needed to get to the market. The Express was too big, too fast, too important. It flew past those places as if they didn't exist.
The villagers wrote letters. They complained. They walked for hours to reach the Express stations on the main line. And slowly, the word spread: We need the little train back.
The Return
A young railway engineer named Dipali was sent to inspect the old narrow-gauge line. She walked every kilometre, checking the rails, the bridges, the tunnels barely wider than a bullock cart. She found Bogi on her siding, rusted but intact.
"Can you still run?" Dipali asked, knocking on Bogi's boiler.
Bogi's firebox was cold. Her pistons were stiff. Her brake shoes were nearly worn through. But somewhere deep inside her iron bones, a spark of warmth remained.
"Light my fire," said Bogi, "and find out."
Dipali and her team spent two weeks repairing Bogi. They patched her boiler, oiled her valves, replaced her brake shoes, and polished her whistle until it sang clear and true. On a bright February morning, with the hills glowing gold in the winter sun, Bogi's fire was lit again.
She coughed. She sputtered. Then she roared — a sound so joyful that the stationmaster dropped his ledger and the birds in the signal box flew out in surprise.
The Hill Train's Purpose
Bogi runs again today. Not on the main line — that belongs to the Express. Bogi runs the old route, the winding, climbing, impossible route that hugs the hillsides and stops at every tiny village. She carries schoolchildren and market women and postal bags and, occasionally, a goat.
She is slower than the Express. She is smaller, older, and louder. But she goes where the Express cannot — into the folds and creases of the hills, to the places that big trains think are too small to matter.
"The big train carries the most people," Dipali said at the re-opening ceremony. "But the little train carries the people who need it most."
And Bogi, puffing proudly at the platform, blew her whistle and agreed.
In the hills of Northeast India, they say that every train has a soul, and the soul of a hill train is the stubbornest soul of all. It doesn't care about speed or size or shiny paint. It cares about one thing only: getting there.
The end.
Choose your level. Everyone starts with the story — the code gets deeper as you go.
Here is a taste of what Level 1 looks like for this lesson:
import numpy as np
import matplotlib.pyplot as plt
# How much force does a hill train need?
mass = 50000 # kg (50 tonnes)
g = 9.81 # gravity
gradients = np.array([0, 1, 2, 3, 5, 8]) # percent
# Grade resistance = mass * g * sin(angle)
# For small angles, sin(angle) ≈ gradient/100
force_kN = mass * g * (gradients / 100) / 1000
plt.bar(gradients, force_kN, color='steelblue')
plt.xlabel("Gradient (%)")
plt.ylabel("Force needed (kN)")
plt.title("Why Hill Trains Need So Much Power")
plt.show() # What happens at 8%?This is just the first of 6 coding exercises in Level 1. By Level 4, you will build: Calculate the Physics of a Mountain Railway.
By Level 4, enrolled students build: Calculate the Physics of a Mountain Railway
Free
Level 0: Listener
Stories, science concepts, diagrams, quizzes. No coding.
You are here
Level 0 is always free. Coding levels (1-4) are part of our 12-Month Curriculum.
Narrow gauge railways — engineering on steep gradients.
The big idea: "The Little Train of the Hills" teaches us about Mechanical Engineering & Railways — and you don't need to write a single line of code to understand it.
Imagine pushing a heavy box across a polished marble floor. It slides easily — almost too easily. Now imagine pushing it across rough sandpaper. Much harder. The difference is friction: the force that resists two surfaces sliding against each other. Every surface has a friction coefficient (μ), a number between 0 and 1 that tells you what fraction of the pressing-down force becomes sideways grip.
A train wheel does something that surprises most people: it does not slide along the rail. The bottom of the wheel, at the point where it touches the rail, is momentarily stationary — just like the bottom of your shoe when you walk. The wheel rolls, and the friction at the contact point pushes the train forward. This is called adhesion, and it is the entire reason trains work. If the wheel slipped freely on the rail (like a car on ice), no engine in the world could move the train.
Here is the key equation: Maximum pushing force = μ × weight on driving wheels. For dry steel on steel, μ ≈ 0.30. So a locomotive with 20 tonnes on its driving wheels can push with a maximum force of 0.30 × 20,000 × 9.81 = 58,860 N, or about 59 kN. If the train needs more force than this to climb a hill, the wheels will spin uselessly — the driver has to reduce power or add sand to the rails to increase μ.
Check yourself: Why does the Darjeeling railway sprinkle sand on the rails when it rains? Rain reduces μ from 0.30 to about 0.15, halving the maximum grip. Fallen leaves are even worse (μ drops to 0.05). Sand particles dig into the leaf/water film and restore grip — every locomotive carries a sand box for exactly this purpose.
Key idea: A train grips the rail through adhesion — static friction at the wheel-rail contact. The maximum force equals the friction coefficient times the weight on the driving wheels. When this force is not enough (wet rails, steep grades), the wheels slip.
You can feel gears working every time you ride a bicycle. In low gear, pedalling is easy but you move slowly. In high gear, each pedal stroke covers more ground but your legs strain on hills. A gear does not create energy out of nothing — it trades speed for force, or force for speed. The total work (force × distance) stays the same.
The gear ratio tells you the trade-off. If the engine’s gear has 20 teeth and the wheel’s gear has 40 teeth, the ratio is 2:1. The wheel turns at half the engine’s speed, but with double the torque (twisting force). Hill trains use gear ratios of 4:1 or higher on steep sections, sacrificing speed for the pulling force needed to drag carriages uphill.
Gradient (or grade) measures how steep the track is: gradient (%) = (rise / horizontal run) × 100. A 2% gradient means the track rises 2 metres for every 100 metres. This sounds gentle, but for a 200-tonne train, the component of gravity pulling it back downhill is 200,000 × 9.81 × 0.02 = 39,240 N — nearly 40 kN. At 5%, it jumps to almost 100 kN. At 8%, ordinary wheels slip and you need something extra.
That something extra is a rack-and-pinion system. A toothed gear (pinion) on the locomotive meshes with a toothed rail (rack) bolted between the running rails. The teeth lock together mechanically, so slipping is impossible no matter how steep the grade. The Nilgiri Mountain Railway in Tamil Nadu uses this on its steepest section (8.33%), and Switzerland’s Pilatus Railway tackles an astonishing 48% gradient — almost one metre up for every two metres forward.
Key idea: Gears trade speed for force by changing the ratio between input and output. Hill trains use high gear ratios and, on extreme gradients above 8%, rack-and-pinion systems that make slipping mechanically impossible.
Access all 130+ lessons, quizzes, interactive tools, and offline activities
Every steam engine is, at its heart, a device for boiling water in a sealed container and using the pressure of the trapped steam to push a piston. Th...
A straight road up a steep mountain would be impossibly steep for a train. Imagine climbing a staircase versus walking up a gently winding ramp to the...