Work
In physics, work is force times distance, but only when the force is constant. Springs, gravity far from Earth and pumping a tank of water all involve forces that change along the way, or many small pieces moved different distances. The integral handles both, with the same slice-and-sum reasoning used for areas and volumes. This lesson covers variable forces, Hooke's law, pumping problems and the work needed to escape a planet's gravity.
Constant and variable forces
With a constant force along the direction of motion over a distance , . In SI units force is in newtons (N), distance in metres, and work in joules ().
If the force varies with position, split into pieces of width . On each piece the force is nearly constant, so the work is about . Summing and taking the limit:
Springs: Hooke's law
A spring stretched metres beyond its natural length pulls back with force (Hooke's law, valid for small ). The force needed to hold it there is , so stretching it from to takes
Example. A force of 30 N stretches a spring 0.12 m. Then . Stretching it from 0.12 m to 0.30 m takes . Note that the second 0.18 m costs far more than the first 0.12 m (1.8 J), because the force keeps growing.
Work from measured forces
A force sensor on a testing rig records the force at several positions; the work is the area under the force–displacement curve:
import numpy as np
from scipy.integrate import simpson, trapezoid
x = np.array([0.00, 0.02, 0.04, 0.06, 0.08, 0.10, 0.12]) # m
F = np.array([0.0, 41.0, 79.0, 112.0, 138.0, 152.0, 158.0]) # N (a stiffening-then-yielding part)
print(f"work (trapezoid) = {float(trapezoid(F, x=x)):.3f} J")
print(f"work (Simpson) = {float(simpson(F, x=x)):.3f} J")work (trapezoid) = 12.020 J
work (Simpson) = 12.080 J
Pumping problems: different distances, same idea
To empty a tank by pumping water over its top, each thin layer of water travels a different distance. Slice the liquid into horizontal layers of thickness : for a layer at height ,
with for water and .
Example. A tank is an inverted cone (vertex down) of height 4 m and top radius 2 m, filled to a depth of 3 m. Water is pumped out over the rim. At height above the vertex, the radius is (similar triangles), so , and the layer rises :
import sympy as sp
y = sp.symbols('y', nonnegative=True)
rho, g = 1000, sp.Rational(98, 10)
A = sp.pi * (y / 2)**2
W = sp.integrate(rho * g * A * (4 - y), (y, 0, 3))
print("W =", sp.nsimplify(W), "J ≈", round(float(W) / 1000, 2), "kJ")
# Sanity check: all the water lifted from the height of its centre of mass
V = sp.integrate(A, (y, 0, 3))
y_bar = sp.integrate(y * A, (y, 0, 3)) / V
print("water volume =", V, " centre of mass at y =", y_bar)
print("ρ g V (4 - y_bar) =", sp.nsimplify(rho * g * V * (4 - y_bar)))W = 77175*pi/2 J ≈ 121.23 kJ
water volume = 9*pi/4 centre of mass at y = 9/4
ρ g V (4 - y_bar) = 77175*pi/2
The check uses a useful fact: the work to lift a body equals its weight times the distance its centre of mass rises. Both routes give the same number.
Escaping a planet
Gravity weakens with distance: a mass at distance from the centre of a planet of mass feels force . Lifting it from the surface () to infinitely far away takes
an improper integral with a finite value. Setting this equal to the kinetic energy gives the escape velocity :
import math
from scipy.integrate import quad
G, M, R = 6.674e-11, 5.972e24, 6.371e6 # SI units, Earth
m = 1.0 # per kilogram
W_formula = G * M * m / R
W_numeric, _ = quad(lambda r: G * M * m / r**2, R, math.inf)
print(f"work per kg: {W_formula:.4e} J (formula), {W_numeric:.4e} J (quad)")
print(f"escape velocity ≈ {math.sqrt(2 * G * M / R) / 1000:.2f} km/s")work per kg: 6.2560e+07 J (formula), 6.2560e+07 J (quad)
escape velocity ≈ 11.19 km/s
In software
- Physics engines and the work-energy theorem. The work done by all forces equals the change in kinetic energy. Engines monitor total energy to detect integrator drift: an explicit Euler integrator adds energy to a spring system each step (the oscillation grows), while symplectic integrators keep it bounded (Game Physics).
- Energy metering. Electrical energy is the integral of power over time (); smart meters and battery fuel gauges integrate sampled power just as the force-sensor example integrated force.
- Line integrals. When the force and the path are both vectors, work becomes , a line integral, the basis of potential energy in games and robotics.
Exercises
Exercise 1: A spring
A spring has natural length 20 cm. A force of 40 N holds it at 25 cm. How much work stretches it from 25 cm to 30 cm?
Answer
3 J.
Solution
Exercise 2: Lifting a chain
A 10 m chain with mass 2 kg/m hangs from the top of a building. How much work pulls it all up to the top?
Answer
980 J.
Solution
A piece of length at depth weighs and rises : . Check: weight 196 N, centre of mass rises 5 m.
Exercise 3: Pumping a cylinder
A cylindrical tank of radius 1 m and height 5 m is full of water. Find the work to pump all of it over the top.
Answer
.
Solution
import math
from scipy.integrate import quad
W = quad(lambda y: 1000 * 9.8 * math.pi * (5 - y), 0, 5)[0]
print(round(W / 1000, 1), "kJ")384.8 kJ
Exercise 4: Halfway to infinity
What fraction of the escape energy is needed to lift a mass from the surface to ?
Answer
One half.
Solution
.
Test yourself
For a spring with constant , the work to stretch it from 0 to is…
In a pumping problem, why do we slice horizontally?
- It is a convention
- The tank is always a cylinder
- All water in a thin horizontal layer travels the same distance
- To avoid improper integrals
Why is the work to escape Earth's gravity finite even though the distance is infinite?
- The force decays like , whose integral to infinity converges
- Gravity stops at the atmosphere
- Escape velocity is infinite
- It is not finite