[FORTRAN] Determining Apoapsis + Periapsis (Astrophysics)

  • Context: Fortran 
  • Thread starter Thread starter Nicolaus
  • Start date Start date
  • Tags Tags
    Astrophysics Fortran
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
Nicolaus
Messages
73
Reaction score
0
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.
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 news on Phys.org
Your question doesn't seem to be programming related. On top of that, you seem to post the answer to your own question. Can you be a little bit more clear? Is that program what you're looking for or is it your own unfinished program?