Finding earthquake epicenters


Required math: Equation of a circle.

An earthquake is a shaking of the surface of the Earth due to sudden movements in tectonic plates. The plates are always moving but could get stuck at places due to friction, accumulating pent up elastic strain energy. The sudden movements release this energy as seismic waves that travel through the Earth away from the earthquake. These seismic waves are detected by seismographs and come in two forms; P-waves and S-waves. P (primary or pressure) waves are longitudinal waves formed from alternating compressions and are detected first by the seismograph. S (secondary or shear) waves are transverse waves. P-waves are detected first because longitudinal waves travel faster than the transverse S-waves in the Earth. (This is a general result as Poisson’s ratio is below 1 for most naturally occurring materials.)

Knowing the velocities of the P and S-waves, and the difference in the arrival times of the P and S-waves, a seismograph station can determine how far away an earthquake's epicenter is. The epicenter is the point on the Earth's surface where the earthquake originated, but not its exact location as earthquakes could occur deep underground. Two seismographs can pinpoint the epicenter down to two possible locations and three are required to determine the epicenter uniquely.


An earthquake occurs at some unknown location $(x,y), -100 < x,y < 100 \; [\mathrm{km}]$. Modeling the Earth's surface as a flat 2D plane, the earthquake emits seismic waves which travel through the Earth and are detected by three seismographs. Given the arrival times of the faster P-waves and slower S-waves, and the locations of the three seismographs, determine the earthquake's source or epicenter $(x,y)$. Assume P-waves travel at a constant 6 km/s and S-waves travel at a constant 3 km/s. We're also assuming that the earthquake happens very close to the surface and that the seismographs are close to each other so the Earth's curvature is negligible.


One line for each earthquake event, containing the x and y-coordinates of the seismograph and the difference in arrival times of the P and S-waves.

Example input
x1 y1 t1 x2 y2 t2 x3 y3 t3
8.38235322677 -58.0037208141 12.8607541935 -13.590571819 73.976069096 22.8474885484 77.2911723706 7.50876445638 5.76780978383


A single line for each earthquake event giving the (x,y) coordinate of the earthquake in kilometers.

Example output
79.0674612756 -27.0524778103

Submit Your Code