Solution (source code)

= Solution

Use the right-handed orthonormal basis $(\mathbf e_r,\mathbf e_\theta,\mathbf e_\phi)$. The <cross product> with $\mathbf e_r$ rotates tangential components by a right angle; taking its <cross product> again in the opposite order projects a <gradient> onto the tangent plane. The <radial curl of angular gradient fields> then depends only on the rotated-gradient part. All coordinate calculations are made away from the polar coordinate singularities and extend wherever the original fields are smooth.