Why Do Vectors Cause Issues in My Orbital Simulation?

  • Thread starter Thread starter exclamaforte
  • Start date Start date
AI Thread Summary
The discussion centers on challenges faced in creating an orbital simulation for a computer science project, particularly issues with vector calculations that result in oblong orbits and sharp corners. The user has implemented the inverse square law correctly but is experiencing unexpected particle paths resembling an isosceles triangle. Suggestions include using specific force equations and ensuring conservation of energy is maintained throughout the simulation. There is also a mention of the complexity of simulating multiple massive objects, although some participants argue that both two-body and three-body problems can be managed with simple integration techniques. The user is considering switching their project if the issue isn't resolved soon.
exclamaforte
Messages
3
Reaction score
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
You shouldn't need to be brute-forcing the equations like that, the force on a particle `i' should simply be
<br /> \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<br />
where the separation vector
<br /> \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}<br />
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.
 
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.
 
Orbital simulations with more than two massive objects are incredibly difficult. It's called the 3 body problem.
 
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.
 
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
 
Publication: Redox-driven mineral and organic associations in Jezero Crater, Mars Article: NASA Says Mars Rover Discovered Potential Biosignature Last Year Press conference The ~100 authors don't find a good way this could have formed without life, but also can't rule it out. Now that they have shared their findings with the larger community someone else might find an explanation - or maybe it was actually made by life.
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...
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