Lesson 15 of 18

Volume of Revolution

Volume of Revolution

Rotating a curve y=f(x)y = f(x) around the x-axis sweeps out a solid. We can find its volume using the disk method.

Disk Method

At each xx, the cross-section is a disk with radius f(x)f(x) and area π[f(x)]2\pi [f(x)]^2. Integrating these areas:

V=πab[f(x)]2dxV = \pi \int_a^b [f(x)]^2\, dx

Washer Method

Rotating the region between two curves f(x)f(x) (outer) and g(x)g(x) (inner):

V=πab([f(x)]2[g(x)]2)dxV = \pi \int_a^b \left([f(x)]^2 - [g(x)]^2\right) dx

Each cross-section is a washer (disk with hole).

Classic Examples

Cylinder: rotate f(x)=rf(x) = r (constant) on [0,h][0, h]:

V=πr2hV = \pi r^2 h

Cone: rotate f(x)=rxhf(x) = \frac{rx}{h} (line) on [0,h][0, h]:

V=π0h(rxh)2dx=πr2h2h33=πr2h3V = \pi \int_0^h \left(\frac{rx}{h}\right)^2 dx = \frac{\pi r^2}{h^2} \cdot \frac{h^3}{3} = \frac{\pi r^2 h}{3}

Sphere: rotate f(x)=r2x2f(x) = \sqrt{r^2 - x^2} on [r,r][-r, r]:

V=πrr(r2x2)dx=43πr3V = \pi \int_{-r}^{r} (r^2 - x^2)\, dx = \frac{4}{3}\pi r^3

Numerical Implementation

Use the midpoint rule:

#define PI 3.14159265358979
for each midpoint x:
    sum += f(x) * f(x)
return PI * sum * h

Your Task

Implement double volume_disk(double (*f)(double), double a, double b, int n) that computes πab[f(x)]2dx\pi \int_a^b [f(x)]^2\, dx using the midpoint rule.

TCC compiler loading...
Loading...
Click "Run" to execute your code.