LA 2729

From Algorithmist
Jump to navigation Jump to search

LA 2729 - The Solar System[edit]


Given are some data about two planets in the same solar system. Use Kepler's laws to calculate the location of one of the planets in a given moment.


From the third law we may compute the period of revolution of the second planet. Now, we compute the time left in the last revolution. We have to find a point on the ellipse that (the part of the ellipse swept by the line planet-sun / ellipse area) = (time left / period of revolution). This involves some calculus. The answer can either be computed directly, or you can find the right point using binary search on the perimeter of the ellipse.


  • Be careful, with all those floating point numbers around it's easy to make precision errors.


10 5 10 10 5 10
10 5 10 20 10 10
0 0 0 0 0 0


Solar System 1: 10.000 0.000
Solar System 2: -17.525 4.819