Welcome, Guest. Please Login.
Gravity Simulator
11/23/17 at 17:48:33
News: Registration for new users has been disabled to discourage spam. If you would like to join the forum please send me an email with your desired screen name to tony at gravitysimulator dot com.
Home Help Search Login


Pages: 1
Reply Send Topic Print
Differential Equation(s)? (Read 5310 times)
Dave Mongoose
Guest



Differential Equation(s)?
08/17/05 at 09:17:00
 
Hi,
I'm a student in the UK and, as a mathematics project, I'm trying to create a simple orbit model (the Earth and the Sun, for example) using Euler's method to get numerical solutions. Unfortunately I can't find the differential equation(s) I need, so I haven't been able to get anywhere.
 
Could you point me to the equation(s) I need? As far as I know I'm looking for one(s) that will give polar coordinates, but I could be wrong.
Back to top
 
 
Email   IP Logged
Tony
YaBB Administrator
*****




Posts: 1051
Gender: male
Re: Differential Equation(s)?
Reply #1 - 08/17/05 at 10:28:19
 
Gravity Simulator uses state vectors.  Internally, it recognizes objects by their X,Y & Z positions and velocities rather than polar cordinates.
 
To do a simple Euler method here's an outline of how to do it in 2 dimensions:
 
Consider the Sun to be stationary at the 0,0 point (x,y).  The Earth travels around the Sun at about 30 kilometers / second from a distance of about 1,500,000 kilometers.  Convert these to MKS and you get 3000 m/s and 1.5 x 109 meters.
 
Use this as a starting point.  Place the Earth at one of its 90 degree longitudes.  So:
 
Sun x position : 0
Sun y position : 0
Sun x velocity : 0
Sun y velocity: 0
 
Earth x position: 1.5 x 109
Earth y position: 0
Earth x velocity: 0
Earth y velocity: 3000
 
You now have a stationary model of the Earth and Sun.  To propogate this orbit into the future:
 
To keep things simple, use a time step of 1 second.  Every 1 second you are going to re-compute the position of the Earth.
 
Compute the acceleration the Earth will experience from the Sun:  a = GM / d2.  For G use 6.67 x 10-11.  For M (the mass of the Sun) use 1.989 x 1030.  And for d, calculate your distance using sqrt (Earth x position squared + Earth y position squared).
 
Now that you know your acceleration, break it up into its components x & y.
 
Add the Earth's acceleration components to its velocity components x & y.  Then add its velocity components to its position components x & y.
 
Repeat millions of times and the Earth will go around the Sun.
 
You could get more complicated by letting the Earth tug back at the Sun, introducing more than 2 objects, and introducing a z component to the system.  This is basically how Gravity Simulator works.
 
I hope this helps.
Back to top
 
 
Email View Profile WWW   IP Logged
Dave Mongoose
Guest



Re: Differential Equation(s)?
Reply #2 - 08/18/05 at 00:01:18
 
Thanks a lot, I think I get it now  Cheesy .  
 
I think I might have found that equation before, but ignored it because I didn't realise it would help. Your explanation has made things much clearer, and I think I'll be able to do it now.
Back to top
 
 
Email   IP Logged
frankuitaalst
Ultimate Member
*****


Great site

Posts: 1507
Gender: male
Re: Differential Equation(s)?
Reply #3 - 11/10/05 at 12:24:04
 
RE : Integration and accurateness .  
 
Hi Tony ,  
Since some weeks I use the programm . It works very well ...and is really amazing ...
I wonder myself if you are somebody else has any idea about the accurateness of the iterations . I know from experience that such calculations can become "instable" whem the time step is too big .  
I wonder if there is some experience on this field ( f.i comparision of the output of the programm to some exactly known orbits , f.i. in case of a circular motion of two bodies ).  
 
Other question : is the program still under revision , or do you foresee updates with new features ?  
 
Kind Regards .  
Frank Kestens
Back to top
 
 
Email View Profile   IP Logged
Tony
YaBB Administrator
*****




Posts: 1051
Gender: male
Re: Differential Equation(s)?
Reply #4 - 11/11/05 at 12:08:13
 
Quote from frankuitaalst   on 11/10/05 at 12:24:04:
RE : Integration and accurateness .

Hi Tony ,
Since some weeks I use the programm . It works very well ...and is really amazing ...
I wonder myself if you are somebody else has any idea about the accurateness of the iterations . I know from experience that such calculations can become "instable" whem the time step is too big .
I wonder if there is some experience on this field ( f.i comparision of the output of the programm to some exactly known orbits , f.i. in case of a circular motion of two bodies ).

Other question : is the program still under revision , or do you foresee updates with new features ?

Kind Regards .
Frank Kestens

One way to determine if your time step is too fast is to repeat the simulation at a slower time step.  If you get different results, then you were running it too fast.  Keep lowering your time step until your results converge on the same answer.
 
The simplest way to test your results against known values is to simply verify that the Earth passes the same point on the same date each year.
 
A more accurate test would be to look up the dates, times, and distances of Venus or Mars close approaches.  Then begin with the simulation 'fullsystem.gsim' and propogate the simulation forwards or backwards to those dates.  Use a 'distance and velocity' box to verify your close approach when your radial velocity drops to 0.  Then check your date and distance against your researched value.
 
The next version will be a little more accurate in these regards.  I got my hands on a more accurate value for G (15 digits!), as well as more accurate values for the Sun and the planets.  Although the difference isn't huge, it's good enough that I can almost predict eclipses 40 years into the future.  I tried this a few months ago, and the Moon missed by only a couple of hours on the eclipse of 2045, compared to missing by a few days.  Since predicting eclipses was never the goal, the small discrepencies don't bother me that much, but if I can get better results simply by plugging in more accurate values, I might as well.
 
Yes, this is an ongoing work.  I tend to do the majority of work when I'm on vacation.  Most people bring a book to read to kill time.  I bring my laptop so I can code.  There's a few new changes in the development version, but not enough to release it yet.  Maybe by the middle of 2006 version 3 will be released.
Back to top
 
 
Email View Profile WWW   IP Logged
Pages: 1
Reply Send Topic Print