Gravity Simulator http://www.orbitsimulator.com/cgi-bin/yabb/YaBB.pl General >> Discussion >> Differential Equation(s)? http://www.orbitsimulator.com/cgi-bin/yabb/YaBB.pl?num=1124295428 Message started by Dave Mongoose on 08/17/05 at 09:17:00

 Title: Differential Equation(s)? Post by Dave Mongoose on 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.

 Title: Re: Differential Equation(s)? Post by Tony on 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 : 0Sun y position : 0Sun x velocity : 0Sun y velocity: 0Earth x position: 1.5 x 109Earth y position: 0Earth x velocity: 0Earth y velocity: 3000You 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.

 Title: Re: Differential Equation(s)? Post by Dave Mongoose on 08/18/05 at 00:01:18 Thanks a lot, I think I get it now  :D . 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.

 Title: Re: Differential Equation(s)? Post by 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

Title: Re: Differential Equation(s)?
Post by Tony on 11/11/05 at 12:08:13

frankuitaalst wrote:
 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.

 Gravity Simulator » Powered by YaBB 2.1! YaBB © 2000-2005. All Rights Reserved.