Applications to Physics and Engineering
Integrals add up quantities that vary from point to point. This lesson applies that idea to two engineering classics: the force of water on a submerged wall, and the centre of mass of a flat plate. It proves the theorem of Pappus along the way and shows how physics engines compute the centroid of any polygon.
Hydrostatic pressure and force
In a fluid of density at rest, the pressure at depth is (the weight of the column of fluid above a unit area). For water, and . Pressure acts equally in all directions, so a horizontal plate at depth with area feels .
A vertical plate is harder: the depth changes across it. Measure depth downward from the surface and let be the plate's width at depth . A thin horizontal strip of height is at almost constant depth, so it feels . Summing and taking the limit:
Since , where is the depth of the plate's centroid, the integral collapses to a rule engineers use daily: the force equals the pressure at the centroid times the area, . (Where that force acts, the centre of pressure, is lower than the centroid, and needs one more integral.)
import numpy as np
from scipy.integrate import quad
rho_g = 1000 * 9.81
# Rectangular gate, 3 m wide, from depth 1 m to depth 3 m
F_gate, _ = quad(lambda y: rho_g * y * 3.0, 1, 3)
print(f"gate: integral {F_gate:9.1f} N centroid rule {rho_g * 2.0 * 6.0:9.1f} N")
# Circular porthole, radius 0.5 m, centre at depth 4 m: width 2√(r² − (y − 4)²)
w = lambda y: 2 * np.sqrt(max(0.25 - (y - 4) ** 2, 0.0))
F_hole, _ = quad(lambda y: rho_g * y * w(y), 3.5, 4.5)
print(f"porthole: integral {F_hole:9.1f} N centroid rule {rho_g * 4.0 * np.pi * 0.25:9.1f} N")gate: integral 117720.0 N centroid rule 117720.0 N
porthole: integral 30819.0 N centroid rule 30819.0 N
Moments and centres of mass
For point masses at on a line, the balance point is : it is where the total moment is zero. In the plane, the moments about the axes are and , and .
A thin plate (lamina) of uniform density occupying the region under on is a continuum of vertical strips. A strip at has area , and its own centre is at . Summing gives the centroid formulas:
For a region between curves , replace by in and , and by in . Uniform density cancels, so the centroid is pure geometry. Symmetry gives free answers: a region symmetric about a line has its centroid on that line.
import sympy as sp
x, r = sp.symbols("x r", positive=True)
def centroid(f, a, b):
A = sp.integrate(f, (x, a, b))
xbar = sp.integrate(x * f, (x, a, b)) / A
ybar = sp.integrate(f**2 / 2, (x, a, b)) / A
return sp.simplify(A), sp.simplify(xbar), sp.simplify(ybar)
print("under √x on [0, 4]:", centroid(sp.sqrt(x), 0, 4))
print("half disc radius r:", centroid(sp.sqrt(r**2 - x**2), -r, r))under √x on [0, 4]: (16/3, 12/5, 3/4)
half disc radius r: (pi*r**2/2, 0, 4*r/(3*pi))
The half disc's centroid sits at above the diameter; by symmetry.
The theorem of Pappus
Theorem (Pappus). If a plane region of area lies entirely on one side of a line in its plane and is rotated once about , the solid has volume , where is the distance from the centroid to .
Proof (for the y-axis, region between on with ). By cylindrical shells,
In words: the volume is the area times the distance the centroid travels. A torus made by spinning a disc of radius whose centre is from the axis has , with no integral at all.
In software
Physics engines (Box2D, Rapier, PhysX) need the mass, centroid and moment of inertia of every collision shape, because forces and impulses act about the centre of mass (Bodies and forces, Rotation dynamics). For a polygon they never integrate strip by strip: Green's theorem turns the area integrals into sums over the edges (the shoelace formula):
Approximating the region under by a polygon and refining it should reproduce the calculus answer :
import numpy as np
def polygon_centroid(P):
x, y = P[:, 0], P[:, 1]
xn, yn = np.roll(x, -1), np.roll(y, -1)
cross = x * yn - xn * y
A = cross.sum() / 2
return abs(float(A)), float(((x + xn) * cross).sum() / (6 * A)), float(((y + yn) * cross).sum() / (6 * A))
for n in [4, 16, 256]:
xs = np.linspace(0, 4, n + 1)
boundary = np.column_stack([xs, np.sqrt(xs)]) # along the curve, left to right
P = np.vstack([boundary, [[4.0, 0.0]]]) # then down and back along the x-axis
A, cx, cy = polygon_centroid(P)
print(f"n={n:3d}: A={A:.4f} centroid=({cx:.4f}, {cy:.4f})")
print("calculus: A=5.3333 centroid=(2.4000, 0.7500)")n= 4: A=5.1463 centroid=(2.4661, 0.7555)
n= 16: A=5.3086 centroid=(2.4100, 0.7518)
n=256: A=5.3329 centroid=(2.4002, 0.7500)
calculus: A=5.3333 centroid=(2.4000, 0.7500)
The vertex list runs clockwise here, which makes the raw signed area negative; dividing by with the same sign cancels it, which is why the centroid formula is orientation-independent. The first look at areas in the survey course is Area Under and Between Curves.
Exercises
Exercise 1: A triangular sluice gate
A vertical triangular plate has its 2 m top edge at the water surface and its vertex 3 m below. Find the hydrostatic force on one face (use ).
Answer
Solution
At depth the width is .
Exercise 2: Sphere from Pappus
Use the half-disc centroid and Pappus' theorem to get the volume of a sphere.
Answer
Solution
Rotate the half disc about its diameter: .
Exercise 3: Region between two curves
Find the centroid of the region between and on .
Answer
Solution
import sympy as sp
x = sp.symbols("x")
A = sp.integrate(x - x**2, (x, 0, 1))
print(sp.integrate(x * (x - x**2), (x, 0, 1)) / A, sp.integrate((x**2 - x**4) / 2, (x, 0, 1)) / A)1/2 2/5
Exercise 4: Centroid of an L-shaped polygon
Compute the centroid of the polygon with the shoelace formulas, and confirm it by splitting it into two rectangles.
Answer
Area 6, centroid .
Solution
Rectangles: (area 4, centre ) and (area 2, centre ). Then , .
import numpy as np
P = np.array([(0, 0), (4, 0), (4, 1), (1, 1), (1, 3), (0, 3)], dtype=float)
x, y = P[:, 0], P[:, 1]
xn, yn = np.roll(x, -1), np.roll(y, -1)
c = x * yn - xn * y
A = c.sum() / 2
print(float(A), float(((x + xn) * c).sum() / (6 * A)), float(((y + yn) * c).sum() / (6 * A)))6.0 1.5 1.0
Test yourself
Two vertical plates with the same shape and area are submerged, one with its centroid at 2 m depth, the other at 6 m. How do the hydrostatic forces compare?
- Equal
- The deeper one feels 3 times the force
- The deeper one feels 9 times the force
- The shallower one feels more
Why does the formula for contain ?
- Because of the Pythagorean theorem
- It comes from integrating by parts
- Each vertical strip has area and its own centre at height
- It is the moment of inertia
A square of side 2 whose centre is 5 units from an axis is rotated about it. What is the volume?