Algorithm for Studying Planets