Solution (source code)

= Solution

Write
$$
q(v)=\sqrt{f'(v)^2+g'(v)^2}.
$$
The regularity of the profile makes $q>0$. The coordinate tangent vectors are
$$
\phi_u=(-f\sin u,f\cos u,0),
\qquad
\phi_v=(f'\cos u,f'\sin u,g'),
$$
so the <first fundamental form of a surface of revolution> has coefficients
$$
E=f^2,
\qquad F=0,
\qquad G=q^2.
$$
Choose the <unit normal>
$$
N=\frac1q(-g'\cos u,-g'\sin u,f').
$$
Taking scalar products with the second derivatives of $\phi$ gives the <second fundamental form> coefficients
$$
e=\frac{fg'}q,
\qquad f_{\mathrm{II}}=0,
\qquad g_{\mathrm{II}}=\frac{f'g''-g'f''}q.
$$
Thus the coordinate directions are <principal direction>[principal directions], with <principal curvature>[principal curvatures]
$$
k_1=\frac{g'}{fq},
\qquad
k_2=\frac{f'g''-g'f''}{q^3}.
$$
The <curvatures of a parametrized surface of revolution> are therefore
$$
\boxed{H=\frac12\left(\frac{g'}{fq}+\frac{f'g''-g'f''}{q^3}\right),
\qquad
K=\frac{g'(f'g''-g'f'')}{fq^4}.}
$$
Reversing the <orientation of a surface> reverses the sign of $H$ but leaves $K$ unchanged.