Say the focus point - the Sun - is at P(0,0), would I then determine the apoapsis (periapsis) by implementing the Pythagorean Theorem on each point to determine which point's distance is largest (smallest for periapsis) from the origin, then output the coordinates for each? Each coordinate to be checked is extracted from an array.(adsbygoogle = window.adsbygoogle || []).push({});

Exampled program for computing apoapsis:

apo = 0

do i = 1, lengthAR

d = sqrt((xAR(i)**2) + (yAR(i)**2))

if (d .gt. apo) then

apo = d

x = xAR(i)

y = yAR(i)

end if

end do

print*, "Apoapsis = ", x, y

end

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# [FORTRAN] Determining Apoapsis + Periapsis (Astrophysics)

**Physics Forums - The Fusion of Science and Community**