Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

[FORTRAN] Determining Apoapsis + Periapsis (Astrophysics)

  1. Mar 29, 2013 #1
    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
     
  2. jcsd
  3. Apr 3, 2013 #2
    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?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook