UlcerIndex function

calculate the Ulcer Index