TExcelTAD
Home › Calculus in Depth › Applications to Physics and Engineering

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 ρ\rho at rest, the pressure at depth dd is P=ρgdP = \rho g d (the weight of the column of fluid above a unit area). For water, ρ≈1000 kg/m3\rho \approx 1000\ \text{kg/m}^3 and ρg≈9810 N/m3\rho g \approx 9810\ \text{N/m}^3. Pressure acts equally in all directions, so a horizontal plate at depth dd with area AA feels F=ρgdAF = \rho g d A.

A vertical plate is harder: the depth changes across it. Measure depth yy downward from the surface and let w(y)w(y) be the plate's width at depth yy. A thin horizontal strip of height Δy\Delta y is at almost constant depth, so it feels ρgy⋅w(y) Δy\rho g y \cdot w(y)\,\Delta y. Summing and taking the limit:

F=∫abρgy⋅w(y) dy(a,b=depths of the top and bottom of the plate)F = \int_a^b \rho g y \cdot w(y)\,dy \qquad (a, b = \text{depths of the top and bottom of the plate})

Since ∫y w(y) dy=yˉ⋅A\int y\,w(y)\,dy = \bar{y} \cdot A, where yˉ\bar{y} 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, F=ρgyˉAF = \rho g \bar{y} A. (Where that force acts, the centre of pressure, is lower than the centroid, and needs one more integral.)

python · try it yourself
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 mim_i at xix_i on a line, the balance point is xˉ=∑mixi/∑mi\bar{x} = \sum m_i x_i / \sum m_i: it is where the total moment ∑mi(xi−xˉ)\sum m_i(x_i - \bar{x}) is zero. In the plane, the moments about the axes are My=∑mixiM_y = \sum m_i x_i and Mx=∑miyiM_x = \sum m_i y_i, and (xˉ,yˉ)=(My/m,Mx/m)(\bar{x}, \bar{y}) = (M_y/m, M_x/m).

A thin plate (lamina) of uniform density occupying the region under y=f(x)≥0y = f(x) \ge 0 on [a,b][a, b] is a continuum of vertical strips. A strip at xx has area f(x) Δxf(x)\,\Delta x, and its own centre is at (x,f(x)/2)(x, f(x)/2). Summing gives the centroid formulas:

A=∫abf(x) dxxˉ=1A∫abxf(x) dxyˉ=1A∫ab12f(x)2 dx\begin{aligned} A &= \int_a^b f(x)\,dx \\ \bar{x} &= \frac{1}{A} \int_a^b x f(x)\,dx \\ \bar{y} &= \frac{1}{A} \int_a^b \tfrac{1}{2} f(x)^2\,dx \end{aligned}

For a region between curves g≤y≤fg \le y \le f, replace ff by f−gf - g in AA and xˉ\bar{x}, and 12f2\tfrac{1}{2}f^2 by 12(f2−g2)\tfrac{1}{2}(f^2 - g^2) in yˉ\bar{y}. 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.

python · try it yourself
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 4r/(3π)≈0.424 r4r/(3\pi) \approx 0.424\,r above the diameter; xˉ=0\bar{x} = 0 by symmetry.

The theorem of Pappus

Theorem (Pappus). If a plane region of area AA lies entirely on one side of a line ℓ\ell in its plane and is rotated once about ℓ\ell, the solid has volume V=2πdAV = 2\pi d A, where dd is the distance from the centroid to ℓ\ell.

Proof (for the y-axis, region between g≤fg \le f on [a,b][a, b] with a≥0a \ge 0). By cylindrical shells,

V=∫ab2πx(f(x)−g(x)) dx=2π⋅∫abx(f−g) dx=2π⋅(xˉA)=2πxˉA■V = \int_a^b 2\pi x (f(x) - g(x))\,dx = 2\pi \cdot \int_a^b x (f - g)\,dx = 2\pi \cdot (\bar{x} A) = 2\pi \bar{x} A \qquad \blacksquare

In words: the volume is the area times the distance the centroid travels. A torus made by spinning a disc of radius rr whose centre is RR from the axis has V=2πR⋅πr2=2π2Rr2V = 2\pi R \cdot \pi r^2 = 2\pi^2 R r^2, 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):

A=12∑(xiyi+1−xi+1yi)xˉ=16A∑(xi+xi+1)(xiyi+1−xi+1yi),yˉ likewise with y\begin{aligned} A &= \tfrac{1}{2} \sum (x_i y_{i+1} - x_{i+1} y_i) \\ \bar{x} &= \frac{1}{6A} \sum (x_i + x_{i+1})(x_i y_{i+1} - x_{i+1} y_i), && \bar{y} \text{ likewise with } y \end{aligned}

Approximating the region under x\sqrt{x} by a polygon and refining it should reproduce the calculus answer (2.4,0.75)(2.4, 0.75):

python · try it yourself
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 6A6A 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 ρg=9810 N/m3\rho g = 9810\ \text{N/m}^3).

Answer

F=3ρg=29 430 NF = 3\rho g = 29\,430\ \text{N}

Solution

At depth yy the width is w(y)=2(1−y/3)w(y) = 2(1 - y/3).

F=ρg∫03y⋅2(1−y/3) dy=ρg⋅2⋅[y22−y39]03=ρg⋅2⋅(4.5−3)=3ρgCheck: centroid depth=3/3=1 m, area=12⋅2⋅3=3 m2, F=ρg⋅1⋅3✓\begin{aligned} F &= \rho g \int_0^3 y \cdot 2(1 - y/3)\,dy = \rho g \cdot 2 \cdot \left[\frac{y^2}{2} - \frac{y^3}{9}\right]_0^3 = \rho g \cdot 2 \cdot (4.5 - 3) = 3\rho g \\ &\text{Check: centroid depth} = 3/3 = 1\ \text{m},\ \text{area} = \tfrac{1}{2} \cdot 2 \cdot 3 = 3\ \text{m}^2,\ F = \rho g \cdot 1 \cdot 3 \quad \checkmark \end{aligned}

Exercise 2: Sphere from Pappus

Use the half-disc centroid 4r/(3π)4r/(3\pi) and Pappus' theorem to get the volume of a sphere.

Answer

V=4πr3/3V = 4\pi r^3/3

Solution

Rotate the half disc about its diameter: V=2π⋅4r3π⋅πr22=4πr33V = 2\pi \cdot \frac{4r}{3\pi} \cdot \frac{\pi r^2}{2} = \frac{4\pi r^3}{3}.

Exercise 3: Region between two curves

Find the centroid of the region between y=xy = x and y=x2y = x^2 on [0,1][0, 1].

Answer

(12,25)\left(\frac{1}{2}, \frac{2}{5}\right)

Solution
A=∫01(x−x2) dx=16xˉ=6∫01x(x−x2) dx=6(13−14)=12yˉ=6∫0112(x2−x4) dx=3(13−15)=25\begin{aligned} A &= \int_0^1 (x - x^2)\,dx = \frac{1}{6} \\ \bar{x} &= 6 \int_0^1 x(x - x^2)\,dx = 6 \left(\frac{1}{3} - \frac{1}{4}\right) = \frac{1}{2} \\ \bar{y} &= 6 \int_0^1 \tfrac{1}{2}(x^2 - x^4)\,dx = 3 \left(\frac{1}{3} - \frac{1}{5}\right) = \frac{2}{5} \end{aligned}
python · try it yourself
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 (0,0),(4,0),(4,1),(1,1),(1,3),(0,3)(0,0), (4,0), (4,1), (1,1), (1,3), (0,3) with the shoelace formulas, and confirm it by splitting it into two rectangles.

Answer

Area 6, centroid (1.5,1.0)(1.5, 1.0).

Solution

Rectangles: [0,4]×[0,1][0,4] \times [0,1] (area 4, centre (2,0.5)(2, 0.5)) and [0,1]×[1,3][0,1] \times [1,3] (area 2, centre (0.5,2)(0.5, 2)). Then xˉ=(4⋅2+2⋅0.5)/6=1.5\bar{x} = (4 \cdot 2 + 2 \cdot 0.5)/6 = 1.5, yˉ=(4⋅0.5+2⋅2)/6=1\bar{y} = (4 \cdot 0.5 + 2 \cdot 2)/6 = 1.

python · try it yourself
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?

  1. Equal
  2. The deeper one feels 3 times the force
  3. The deeper one feels 9 times the force
  4. The shallower one feels more

Why does the formula for yˉ\bar{y} contain 12f(x)2\tfrac{1}{2}f(x)^2?

  1. Because of the Pythagorean theorem
  2. It comes from integrating by parts
  3. Each vertical strip has area f(x)Δxf(x)\Delta x and its own centre at height f(x)/2f(x)/2
  4. 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?

  1. 40π40\pi
  2. 20π20\pi
  3. 10π10\pi
  4. 80π80\pi