Integration measures accumulation. Once you can integrate, you can compute area between curves, volumes of revolution, arc length, and work. Each application sets up the same pattern: slice the problem into thin pieces, write a Riemann sum, take the limit.
Area between curves
The area between f(x) and g(x) on [a, b], where f(x) ≥ g(x), is the integral of their difference. Each thin vertical strip has width dx and height f(x) − g(x).
Scheme
; Area between f(x) = x^2 + 1 and g(x) = x on [0, 2]; A = integral from 0 to 2 of (f(x) - g(x)) dx
(define (f x) (+ (* x x) 1))
(define (g x) x)
; Numerical integration via midpoint rule
(define (integrate fn a b n)
(let* ((dx (/ (- b a) n))
(sum 0))
(do ((i 0 (+ i 1)))
((= i n) (* sum dx))
(let ((mid (+ a (* dx (+ i 0.5)))))
(set! sum (+ sum (fn mid)))))))
(define area
(integrate (lambda (x) (- (f x) (g x))) 021000))
(display "Area between x^2+1 and x on [0,2] = ")
(display area) (newline)
; Exact answer: integral of (x^2 - x + 1) = [x^3/3 - x^2/2 + x] from 0 to 2; = 8/3 - 2 + 2 = 8/3 = 2.6667
(display "Exact: 8/3 = ")
(display (/ 8.03))
Python
# Area between curvesimport numpy as np
f = lambda x: x**2 + 1
g = lambda x: x
x = np.linspace(0, 2, 10000)
dx = x[1] - x[0]
area = np.sum((f(x) - g(x)) * dx)
print(f"Area between x^2+1 and x on [0,2] = {area:.4f}")
print(f"Exact: 8/3 = {8/3:.4f}")
Volumes of revolution
Rotate a curve around an axis and you get a solid. The disk method stacks circular cross-sections: V = pi integral of r(x)^2 dx. The shell method wraps cylindrical shells: V = 2*pi integral of x*f(x) dx. Use whichever makes the integral simpler.
Scheme
; Volume of revolution: rotate y = sqrt(x) around x-axis on [0, 4]; Disk method: V = pi * integral of (sqrt(x))^2 dx = pi * integral of x dx
(define pi 3.141592653589793)
(define (integrate fn a b n)
(let* ((dx (/ (- b a) n)))
(do ((i 0 (+ i 1))
(sum 0 (+ sum (fn (+ a (* dx (+ i 0.5)))))))
((= i n) (* sum dx)))))
; Disk method: integrand is pi * r(x)^2 = pi * x
(define volume-disk
(* pi (integrate (lambda (x) x) 041000)))
(display "V (disk) = pi * integral of x dx from 0 to 4") (newline)
(display " = ") (display volume-disk) (newline)
(display "Exact: 8*pi = ") (display (* 8 pi)) (newline)
; Shell method (rotating same curve around y-axis):; V = 2*pi * integral of x * sqrt(x) dx from 0 to 4
(define volume-shell
(* 2 pi (integrate (lambda (x) (* x (sqrt x))) 041000)))
(display "V (shell, y-axis) = ") (display volume-shell) (newline)
(display "Exact: 128*pi/5 = ") (display (* (/ 1285.0) pi))
The length of a curve y = f(x) from a to b is the integral of sqrt(1 + (f'(x))^2) dx. Each tiny segment has length sqrt(dx^2 + dy^2) = sqrt(1 + (dy/dx)^2) * dx.
Scheme
; Arc length of y = x^(3/2) from 0 to 4; dy/dx = (3/2) * x^(1/2); L = integral of sqrt(1 + (9/4)*x) dx from 0 to 4
(define (integrate fn a b n)
(let* ((dx (/ (- b a) n)))
(do ((i 0 (+ i 1))
(sum 0 (+ sum (fn (+ a (* dx (+ i 0.5)))))))
((= i n) (* sum dx)))))
(define arc-length
(integrate
(lambda (x) (sqrt (+ 1 (* (/ 94.0) x))))
041000))
(display "Arc length of y = x^(3/2) on [0,4] = ")
(display arc-length) (newline)
; Exact: (2/27)*((10)^(3/2) - 1) = (2/27)*(31.623 - 1) = 2.268
(display "Exact: (2/27)*(10^1.5 - 1) = ")
(display (* (/ 227.0) (- (expt 101.5) 1)))
Python
# Arc length of y = x^(3/2) on [0, 4]importmathdef integrate(fn, a, b, n=10000):
dx = (b - a) / n
returnsum(fn(a + dx * (i + 0.5)) for i inrange(n)) * dx
arc_length = integrate(lambda x: math.sqrt(1 + (9/4) * x), 0, 4)
exact = (2/27) * (10**1.5 - 1)
print("Arc length of y = x^(3/2) on [0,4] = " + format(arc_length, ".4f"))
print("Exact: (2/27)*(10^1.5 - 1) = " + format(exact, ".4f"))
Work
Work = force times distance. When force varies with position, W = integral of F(x) dx. Hooke's law for a spring: F(x) = kx, so the work to stretch a spring from 0 to d is k*d^2/2.
Scheme
; Work to stretch a spring (Hooke's law: F = kx); k = 50 N/m, stretch from x=0 to x=0.3 m
(define k 50)
(define (integrate fn a b n)
(let* ((dx (/ (- b a) n)))
(do ((i 0 (+ i 1))
(sum 0 (+ sum (fn (+ a (* dx (+ i 0.5)))))))
((= i n) (* sum dx)))))
(define work
(integrate (lambda (x) (* k x)) 00.31000))
(display "Work = integral of 50x dx from 0 to 0.3") (newline)
(display " = ") (display work) (display " J") (newline)
(display "Exact: k*d^2/2 = ") (display (* 0.5 k 0.30.3)) (display " J")
Python
# Work to stretch a spring (Hooke's law)
k = 50# N/mdef integrate(fn, a, b, n=10000):
dx = (b - a) / n
returnsum(fn(a + dx * (i + 0.5)) for i inrange(n)) * dx
work = integrate(lambda x: k * x, 0, 0.3)
exact = 0.5 * k * 0.3**2print("Work = integral of 50x dx from 0 to 0.3")
print(" = " + format(work, ".4f") + " J")
print("Exact: k*d^2/2 = " + format(exact, ".4f") + " J")