How do I compute Gaussian curvature in cylindrical coordinates? I just asked this question on ask.metafilter, and it was suggested that I ask here.  Though I'm talking about coding something up, this question is about the math behind it, not the implementation.
We have done analysis in the past where we've computed an approximation for Gaussian curvature of a surface in Cartesian coordinates.
What we've been doing for Cartesian (in MATLAB) is
[fu,fv] = gradient(Z)

[fuu, fuv] = gradient(fu)

[fvu,fvv] = gradient(fv)

GC = (fuu*fvv - fuv*fuv)/(1 + fu^2 + fv^2)

So now I have a surface that I'm modeling in cylindrical coordinates, and I can do the same thing as above for $r$ as a function of $\theta$ and $z$. The problem is that it's only taking into account the change in $r$, not the fact that there is curvature inherent in it being a cylinder.
Looking on Wolfram (equations 27, 32 and 37 and thereabouts), it seems like there's a centripetal component that I don't know how to apply. Dividing by the (constant?) radius doesn't seem like it would work, so I think I'm missing something.
Any help would be appreciated, either explaining how to modify these equations to work correctly, or some other approximation that has worked for you.
Thank you.
 A: Your cylindrical coordinate surface $r(\theta,z)$ in Cartesian coordinates is
$$\begin{align*}x&=r(\theta,z)\cos\;\theta\\y&=r(\theta,z)\sin\;\theta\\z&=z\end{align*}$$
which now allows you to apply the usual Gaussian curvature formula. In particular, you should get the expression
$$K=-\frac{r^3\frac{\partial^2 r}{\partial z^2}+r^2\left(\left(\frac{\partial^2 r}{\partial \theta\partial z}\right)^2-\frac{\partial^2 r}{\partial z^2}\frac{\partial^2 r}{\partial \theta^2}\right)+2r\frac{\partial r}{\partial \theta}\left(\frac{\partial^2 r}{\partial z^2}\frac{\partial r}{\partial \theta}-\frac{\partial r}{\partial z}\frac{\partial^2 r}{\partial \theta\partial z}\right)+\left(\frac{\partial r}{\partial \theta}\frac{\partial r}{\partial z}\right)^2}{\left(r^2+\left(r\frac{\partial r}{\partial z}\right)^2+\left(\frac{\partial r}{\partial \theta}\right)^2\right)^2}$$

For completeness, if you have $z$ as a function of $r$ and $\theta$, your Cartesian parametrization is
$$\begin{align*}x&=r\cos\;\theta\\y&=r\sin\;\theta\\z&=z(r,\theta)\end{align*}$$
and the corresponding Gaussian curvature expression is
$$K=\frac{r^2\frac{\partial^2 z}{\partial r^2}\left(\frac{\partial^2 z}{\partial \theta^2}+r\frac{\partial z}{\partial r}\right)-\left(\frac{\partial z}{\partial \theta}-r\frac{\partial^2 z}{\partial r\partial \theta}\right)^2}{\left(r^2\left(\left(\frac{\partial z}{\partial r}\right)^2+1\right)+\left(\frac{\partial z}{\partial \theta}\right)^2\right)^2}$$
I will leave the derivation of the Gaussian curvature expression for
$$\begin{align*}r&=f(u,v)\\\theta&=g(u,v)\\z&=h(u,v)\end{align*}$$
to the interested reader.
A: The Gaussian curvature of a Monge patch in
polar coordinates $(u,v)\mapsto (u\cos v, u\sin v, h(u,v))$ is:
\begin{equation}
    K = \frac{u^2 h_{uu} (uh_u+h_{vv}) - (-h_v+h_u h_{uv})^2}{[u^2(1+h_u^2)+h_v^2]^2},
\end{equation}
where $u$ and $v$ are the radial and angular coordinates, respectively.
Note that differentiation with respect to $u, v$ are
\begin{align}
    \frac{\partial}{\partial u}=\frac{\partial}{\partial r},\\
    \frac{\partial}{\partial v}=\frac{\partial}{\partial\theta}.
\end{align}
See the detailed derivation for both Gaussian $K$ and mean $H$ curvatures in this post
