Energy Conservation

Explore how potential and kinetic energy transform while total mechanical energy remains constant

Energy Conservation

A ball of mass 2 kg starts at height 10 m on a frictionless ramp. The total mechanical energy is 196 J and never changes --- only the split between potential and kinetic energy shifts.

Sliding Down the Ramp

Drag the position to 5 m along the ramp. At that point the ball is at height 7.50 m, carrying 147 J of potential energy and 49 J of kinetic energy, moving at 7 m/s.

Energy vs Position

KEPETotal051015200100200Position along ramp (m)Energy (J)Kinetic energyPotential energyTotal (constant)

Try dragging 5 all the way to 20 m. The potential energy drops to zero and all 196 J converts to kinetic energy --- the ball reaches its maximum speed of 7 m/s.

Try it in Code

import math

# Energy conservation on a frictionless ramp
height = 10       # initial height (m)
mass = 2           # mass (kg)
position = 5   # position along ramp (m)
g = 9.8

current_height = max(0, height * (1 - position / 20))
PE = mass * g * current_height
total_energy = mass * g * height
KE = total_energy - PE
velocity = math.sqrt(2 * KE / mass)

print(f"Potential energy: {PE:.1f} J")
print(f"Kinetic energy: {KE:.1f} J")
print(f"Total energy: {total_energy:.1f} J")
print(f"Velocity: {velocity:.2f} m/s")

What to explore next

You might also like