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

In summary, the conversation is about creating a simulation of the solar system using Kepler's laws. The speaker has been able to translate the laws into a function but is having trouble generating an ellipse from just a position and velocity. They mention using Kepler's laws to predict the solar system's movements, but it may not be reliable due to minor planets and other factors. The conversation ends with the speaker explaining how to work out the orbit using the formula for velocity and solving for the eccentricity.
  • #1
450AHX
3
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
  • #2
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)
 
  • #3
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.
 
  • #4
If you are starting with position and velocity you can work out the orbit in the following way:

From the formula
[tex]v^2 = GM\left ( \frac{2}{r}- \frac{1}{a} \right )[/tex]
(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:
[tex]\pi a^2 \frac{\sqrt{1-e^2}}{P} = \frac{rv \cos \theta }{2}[/tex]

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 [tex]r= \frac{a(1-e^2)}{1+ e \cos \phi}[/tex]

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.
 
  • #5
Thanks. That's what I was looking for.
 

1. What is the purpose of simulating Kepler orbits?

The purpose of simulating Kepler orbits is to model the motion of objects in space according to Kepler's laws of planetary motion. This allows scientists to understand and predict the behavior of celestial bodies such as planets, moons, and comets.

2. What are Kepler's laws of planetary motion?

Kepler's laws state that: 1) planets orbit the sun in elliptical paths with the sun at one focus, 2) the line connecting the sun and the planet sweeps equal areas in equal times, and 3) the square of the orbital period of a planet is proportional to the cube of its semi-major axis.

3. How is a Kepler orbit simulated?

A Kepler orbit can be simulated using mathematical equations, such as the one derived from Newton's laws of motion and gravitation. This equation, known as the Newtonian force equation, takes into account the mass of the two objects and the distance between them to calculate the force of gravity and the resulting acceleration.

4. What factors affect the simulation of Kepler orbits?

The simulation of Kepler orbits can be affected by various factors, such as the mass and distance of the objects, the initial velocity and position of the objects, and any external forces acting on the objects. Other factors, such as the shape of the orbit and the eccentricity of the orbit, can also influence the simulation.

5. What are the applications of simulating Kepler orbits?

The simulation of Kepler orbits has many applications, including space exploration, satellite communications, and the study of planetary systems. It also helps in predicting and preventing potential collisions between celestial bodies and understanding the effects of gravitational forces on objects in space.

Similar threads

  • Astronomy and Astrophysics
Replies
1
Views
6K
  • Mechanics
Replies
28
Views
3K
Replies
4
Views
6K
  • Astronomy and Astrophysics
Replies
19
Views
10K
Replies
1
Views
1K
Replies
4
Views
3K
  • Programming and Computer Science
Replies
8
Views
2K
  • Advanced Physics Homework Help
Replies
2
Views
2K
Replies
1
Views
3K
Replies
1
Views
2K
Back
Top