[FORTRAN] Determining Apoapsis + Periapsis (Astrophysics)

In summary, the conversation is discussing how to determine the apoapsis (or periapsis) of a point, given its coordinates on a graph with the focus point at P(0,0). The proposed method is to use the Pythagorean Theorem on each point to find the distance from the origin and then compare to find the point with the largest (or smallest) distance. The provided example program demonstrates this method. However, it is unclear if this is the desired solution or if it is an unfinished program.
  • #1
Nicolaus
73
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
 
Technology news on Phys.org
  • #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?
 

Similar threads

Replies
12
Views
1K
Replies
3
Views
2K
Replies
6
Views
2K
Replies
22
Views
5K
Replies
4
Views
1K
Replies
12
Views
15K
Replies
4
Views
1K
Back
Top