Updated gradient function documentation