How can I generate an elliptical orbit using only position and velocity data?

AI Thread Summary
To generate an elliptical orbit from position and velocity data, one can use specific formulas derived from Kepler's laws. The semi-major axis (a) can be calculated using the equation v^2 = GM(2/r - 1/a), where r is the radial distance and v is the velocity magnitude. Once a is determined, the orbital period (P) can be found, and the eccentricity (e) can be calculated using the areal velocity equation. Finally, the angle (φ) from the current position to periapsis can be derived from the equation r = a(1-e^2)/(1 + e cos φ). This approach allows for the approximation of orbits necessary for simulations without relying on complex software.
450AHX
Messages
3
Reaction score
0
Hi.

I'm writing a simulation of (an approximation of) the solar system. So far I've been able to translate the Wikipedia article on Kepler's laws to a function that uses a description of an elliptical orbit (eccentricity, periapsis, known position in time) to return a position when passed an arbitrary time. My issue is with generating the ellipse when given only a position and a velocity; my analytical geometry-fu is too weak for conics. I can't find much info on this, beyond references to offloading the calculation to software suites (e.g. HORIZONS and SPICE), which is of no use to me.
Can anyone give me a nudge in the right direction?

Thanks.
 
Astronomy news on Phys.org
I think you could have a problem in that 'many body' systems can be really hard to get right.
Especially when many of the bodies making up the whole system are either not well known, or not known at all.
You could probably use Keplers laws to give a reasonable prediction for the solar system using just the Sun and major planets for maybe a few thousands of years.
I think that beyond that extent it could not be reliable due to chaos caused by the minor planets (and other things that are not included in the 'perfect' model)
 
Thanks for replying.
Sorry, I forgot to mention that this is just an approximation for a game; I'm not trying to predict the real future locations of objects. Heavy objects will be put on Kepler rails, and only negligible mass objects will use n-body dynamics. I need to be able to find an ellipse from position and velocity because I want to be able to detect stable orbits of negligible mass satellites to avoid computing the n-body dynamics when not necessary.
 
If you are starting with position and velocity you can work out the orbit in the following way:

From the formula
v^2 = GM\left ( \frac{2}{r}- \frac{1}{a} \right )
(where r is the length of the radial line and v is the magnitude of the velocity. )

you can solve for a, the semi-major axis. From which, you can get the period of the orbit.

Then from:
\pi a^2 \frac{\sqrt{1-e^2}}{P} = \frac{rv \cos \theta }{2}

Where theta is the angle between a line perpendicular to the radial line and the velocity vector ( i.e., for a perfectly circular orbit theta would always be 0), and P is the period of the orbit found above, you can solve for e, the eccentricity of the orbit.(each side of the equation gives the Areal velocity)

Then you can use r= \frac{a(1-e^2)}{1+ e \cos \phi}

to solve for phi, which gives you the angular distance from the present position to periapis.

This should give you the shape of and the orientation for the line of apsides for your orbit.
 
Thanks. That's what I was looking for.
 
TL;DR Summary: In 3 years, the Square Kilometre Array (SKA) telescope (or rather, a system of telescopes) should be put into operation. In case of failure to detect alien signals, it will further expand the radius of the so-called silence (or rather, radio silence) of the Universe. Is there any sense in this or is blissful ignorance better? In 3 years, the Square Kilometre Array (SKA) telescope (or rather, a system of telescopes) should be put into operation. In case of failure to detect...
Thread 'Could gamma-ray bursts have an intragalactic origin?'
This is indirectly evidenced by a map of the distribution of gamma-ray bursts in the night sky, made in the form of an elongated globe. And also the weakening of gamma radiation by the disk and the center of the Milky Way, which leads to anisotropy in the possibilities of observing gamma-ray bursts. My line of reasoning is as follows: 1. Gamma radiation should be absorbed to some extent by dust and other components of the interstellar medium. As a result, with an extragalactic origin, fewer...
This thread is dedicated to the beauty and awesomeness of our Universe. If you feel like it, please share video clips and photos (or nice animations) of space and objects in space in this thread. Your posts, clips and photos may by all means include scientific information; that does not make it less beautiful to me (n.b. the posts must of course comply with the PF guidelines, i.e. regarding science, only mainstream science is allowed, fringe/pseudoscience is not allowed). n.b. I start this...
Back
Top