Why Do Vectors Cause Issues in My Orbital Simulation?

  • Thread starter exclamaforte
  • Start date
In summary, a computer science student is working on an orbital simulation for a final project and has applied the inverse square law but is having trouble with the vectors involved. The resulting path of the particle looks like an isosceles triangle, possibly due to a problem with the granularity of the monitor. Other simulations with the same parameters also show this result. The equations used are the force equation for a particle with mass 'm' and position 'r' in relation to a star with mass 'M' and position 'R'. It is mentioned that orbital simulations with more than two massive objects are difficult and called the three body problem. Another person disagrees and states that the difficulty lies in finding analytic solutions to arbitrary initial configurations. The original poster asks for
  • #1
exclamaforte
3
0
Hello, I am attempting to make an orbital simulation for a final project in a computer science course. I have applied the inverse square law, and that seems to be working fine, but there is a problem with the vectors involved. I have the x component becoming negative when the particle's x value is greater than the sun's x value and vise versa for the y; but this configuration yields oblong orbits and sharp corners in the motion of the particle. The path of the particle ends up looking like a isosceles triangle, with the shorter side near the sun. If anyone knows the specific equations used in orbital simulators and can explain them, it would be much appreciated.
 
Astronomy news on Phys.org
  • #2
You shouldn't need to be brute-forcing the equations like that, the force on a particle `i' should simply be
[tex]
\vec{F} = G\frac{m_i M}{r^3}\cdot r_x + G\frac{m_i M}{r^3}\cdot r_y + G\frac{m_i M}{r^3}\cdot r_z
[/tex]
where the separation vector
[tex]
\vec{r} = \vec{R} - \vec{r}_i = (R_x - r_{i,x})\hat{x} + (R_y - r_{i,y})\hat{y} + (R_z - r_{i,z})\hat{z}
[/tex]
For the star of mass 'M' and position 'R.'

Does that help?

Its hard to tell exactly what the problem you're having is based on just the triangular shape.
 
  • #3
It helps a lot, thank you. I am using those equations, so I know they are not the problem now. I think it might be a problem with the granularity of the monitor. I've been looking at other sims with the same parameters, and they appear to give the same result, just displayed smoother. I'm thinking about just switching my problem if I can work it out soon. I still have a week or so, so it will be fine. Thanks for your help though.
 
  • #4
Orbital simulations with more than two massive objects are incredibly difficult. It's called the 3 body problem.
 
  • #5
Chronos said:
Orbital simulations with more than two massive objects are incredibly difficult. It's called the 3 body problem.

I disagree... from a simulation standpoint, there's really no difference between a two body problem and a three body problem, both are relatively trivial and can be performed on a laptop with very simple integration techniques (for 3-body euler's method would be fine, if a little slow).

The only thing difficult about the three body problem is finding analytic solutions to arbitrary initial configurations--but that's explicitly impossible.
 
  • #6
exclamaforte said:
Hello, I am attempting to make an orbital simulation for a final project in a computer science course. I have applied the inverse square law, and that seems to be working fine, but there is a problem with the vectors involved. I have the x component becoming negative when the particle's x value is greater than the sun's x value and vise versa for the y; but this configuration yields oblong orbits and sharp corners in the motion of the particle. The path of the particle ends up looking like a isosceles triangle, with the shorter side near the sun. If anyone knows the specific equations used in orbital simulators and can explain them, it would be much appreciated.

Without seeing the code it's very hard to guess where the error is...i assume it's just some sort of typo error (y acceleration being changed instead of x, something like that)

One thing you should always do for orbital simulations is to let conservation of energy fall back out of the code. That is, at every step, calculate the kinetic energy of both components, and the potential well between them...that should stay constant - if it doesn't, then there's something wrong with the simulation.

~Lyuokdea
 

FAQ: Why Do Vectors Cause Issues in My Orbital Simulation?

What is the problem with orbital simulation?

The main problem with orbital simulation is that it is a highly complex and dynamic system, making it difficult to accurately predict and simulate the orbital motion of objects in space.

Why is it important to accurately simulate orbital motion?

Accurate orbital simulation is crucial for many scientific and technological applications, such as predicting satellite trajectories, planning space missions, and understanding celestial phenomena.

What are some factors that affect orbital simulation accuracy?

There are several factors that can affect the accuracy of orbital simulation, including gravitational interactions between multiple bodies, atmospheric drag, and variations in the Earth's shape and rotation.

How do scientists account for these factors in orbital simulation?

Scientists use mathematical models and advanced computer algorithms to account for these factors and make more accurate predictions of orbital motion. They also continuously gather new data to improve and refine their models.

Are there any limitations to orbital simulation?

Yes, despite advancements in technology and modeling techniques, there are still limitations to orbital simulation. These include uncertainties in initial conditions and the inability to account for all factors that may affect orbital motion.

Back
Top