Skip to content
Tutorials Center
My learning

Topics

Lesson 44 of 47 · Projects and Practice

Project: a rolling race simulator

Build a numerical simulator for bodies rolling or slipping down a ramp, verify it against the closed-form result and explore friction, angle and shape.

In this project you build a small but real simulator. It takes a body (hoop, cylinder, sphere), a ramp angle and a friction coefficient, and steps the equations of motion forward in time. Along the way you will use almost everything from chapters 5, 6 and 8: rolling constraints, moment of inertia, friction limits and numerical integration.

The result is a program that reproduces the closed-form answer when the body rolls, and goes beyond it when the body slips, a case with no neat formula.

A 15 degree ramp with a sphere, a cylinder and a hoop at their positions after 1.4 seconds
A snapshot of the race at t = 1.4 s: sphere first, cylinder close behind, hoop last.

What you will learn

  • Turn the physics of rolling and slipping into a simulation loop.
  • Switch automatically between rolling and slipping.
  • Verify the simulator against a closed-form result.
  • Explore the effect of shape, angle and friction.

Key terms

Shape factor c = I_G/(m R²): 1 for a hoop, 0.5 for a solid cylinder, 0.4 for a solid sphere.

Rolling without slipping: a = αR and friction below μ_s N.

Slipping: the contact point moves relative to the ramp; kinetic friction μ_k N acts.

Verification: comparing a simulation with a known answer.

The model

A body of mass m, radius R and inertia I_G = c m R² is on a ramp of angle θ. Let x be the distance down the slope and ω the spin that corresponds to rolling down.

If it rolls: a = g sinθ/(1 + c), α = a/R, and the friction needed is f = c m a. Rolling is possible while f ≤ μ N = μ m g cosθ, i.e. μ ≥ c tanθ/(1 + c).

If it slips: friction is kinetic, f = μ m g cosθ, directed up the slope while the contact point still slides downhill. The equations are m a = m g sinθ − f and I_G α = f R, so a = g(sinθ − μ cosθ) and α = f R/I_G = μ g cosθ/(c R). The contact point slides until ωR reaches v; then the body switches to rolling.

The simulator advances x, v, ω with a small time step and, at each step, decides between rolling and slipping by comparing the contact-point slip speed v − ωR with zero.

Building it step by step

  1. State: x, v, ω.
  2. Slip speed: u = v − ω R (positive means the contact point slides down the slope).
  3. If |u| is tiny, assume rolling; compute the required friction and check the limit. If it exceeds μ N, the body slips.
  4. If slipping, use kinetic friction with the sign of u.
  5. Integrate with semi-implicit Euler or RK4; stop at the bottom.

A subtle point is the rolling-to-slipping decision. Treating "tiny" u as exactly zero causes chatter; the code below uses a tolerance proportional to the step size.

Common misconceptions

"Friction always acts up the slope." Only while the contact point slides down. If the body spins faster than rolling speed, friction acts down the slope.

"A body on a frictionless ramp rolls." With no friction there is no moment to spin it: it slides.

"Heavier bodies win the race." The mass cancels; shape decides.

"The simulator is right if it looks right." Verify against the formula in the rolling case.

Try it

The simulator below runs the race for four shapes and prints the time to reach the end, with the closed-form times next to them. With μ = 0.5 all bodies roll and the numbers should agree.

Python The race simulator

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Now explore the design space: how does the time to finish depend on the ramp angle and on the friction coefficient? The program sweeps both for the solid cylinder and prints a small table. The values at low friction show where the cylinder starts to slip.

Python Angle and friction sweep

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Extend the project

  1. Add a block that only slides (c = ∞ is not allowed: set α = 0 instead) and check that its time matches √(2L/(g sinθ)) when μ = 0.
  2. Add air drag −k v²/m to the acceleration and see how it reorders the finish for a long ramp.
  3. Replace the hard-coded loop with RK4 and measure how much larger a step you can use for the same accuracy (see numerical integration).

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. On a frictionless ramp, a cylinder:

    Without friction there is no moment about G, so it slides and does not spin up.
  2. 2. What is the condition for pure rolling on a ramp of angle θ?

    The needed friction c m a must not exceed μ m g cosθ.
  3. 3. For a solid cylinder (c = 0.5), what is the smallest μ to roll on a 30° ramp?

    μ ≥ 0.5 tan30°/1.5 = 0.192.
  4. 4. Why does the code force w = v/R after each rolling step?

    Small numerical errors would otherwise let the body drift into slight slipping.

Summary

  • A simulator needs a state, a rule for the forces (rolling or slipping) and an integrator.
  • Rolling: a = g sinθ/(1 + c) if μ ≥ c tanθ/(1 + c); slipping: kinetic friction decouples a and α.
  • Verify against closed-form results where they exist, then explore beyond them.

Next: Glossary of dynamics terms