# LA 2729

Jump to navigation
Jump to search

## LA 2729 - The Solar System[edit]

## Summary[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.

## Explanation[edit]

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.

## Gotchas[edit]

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

## Input[edit]

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

## Output[edit]

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