Learning Scientific Programming with Python (2nd edition)

P8.2.1: Surface area of revolution

Question P8.2.1

The area of the surface of revolution about the $x$-axis between $a$ and $b$ of the function $y = f(x)$ is given by the integral $$ S = 2\pi\int_a^b y\;\mathrm{d}s, \quad \mathrm{where}\;\mathrm{d}s = \sqrt{1 + \left(\frac{\mathrm{d}y}{\mathrm{d}x}\right)^2}\mathrm{d}x. $$ Use this equation to write a function to determine the surface area of revolution of a function $y=f(x)$ about the $x$-axis, given Python function objects which return $y$ and $\mathrm{d}y/\mathrm{d}x$, and test it for the paraboloid obtained by rotation of the function $f(x) = \sqrt{x}$ about the $x$-axis between $a=0$ and $b=1$. Compare with the exact result, $\pi(5^{3/2}-1)/6$.