Cartesian second derivatives in polar coordinates (source code)

= Cartesian second derivatives in polar coordinates
{c}

For $x=r\cos\theta$, $y=r\sin\theta$ and $r>0$, set $c=\cos\theta$, $s=\sin\theta$. The differential operators are $\partial_x=c\partial_r-(s/r)\partial_\theta$ and $\partial_y=s\partial_r+(c/r)\partial_\theta$. Applying them twice gives
$$
f_{xx}=c^2f_{rr}-\frac{2sc}r f_{r\theta}+\frac{s^2}{r^2}f_{\theta\theta}+\frac{s^2}rf_r+\frac{2sc}{r^2}f_\theta,
$$
$$
f_{yy}=s^2f_{rr}+\frac{2sc}r f_{r\theta}+\frac{c^2}{r^2}f_{\theta\theta}+\frac{c^2}rf_r-\frac{2sc}{r^2}f_\theta.
$$
Their sum is the <Laplacian in polar coordinates>. The first-derivative terms come from differentiating the coordinate coefficients, as required for <second derivatives under a two-variable coordinate change>. The origin is excluded from the coordinate formulas, even when the underlying Cartesian function is smooth there.