Gravitational gradients by tensor analysis with application to spherical coordinates