## calculating Sols Orbit

For the discussion of the sciences. Physics problems, chemistry equations, biology weirdness, it all goes here.

Moderators: gmalivuk, Moderators General, Prelates

siu00cp3
Posts: 5
Joined: Mon Apr 28, 2008 7:46 pm UTC
Location: England
Contact:

### calculating Sols Orbit

Hi.

New here, but from reading the posts it seems there are some smart types hanging around, so this might be the place to get somewhere on this problem.

At present many n-Body models, my own included, need to hold Sol stationary when modelling the Solar System. This is because if it's allowed to move, it's in the wrong orbit (obviously it's not stationary in the real world), and after a few years it moves far enough to wreck the model. In mine it flings Mercury out past Venus after a few decades.

I've generated some artificial planetary systems before by flinging a star at a cluster of planets. That usually results in the star picking up some planets on it's way through and forming a stable system, albeit rarely with everything on a similar plane, so kind of fun, but not much use for this problem.

Does anyone know a resource, or some handy method, for calculating the starting conditions for Sol when the planets have their correct position velocity for a given date relative to the solar system barycenter?
Do not fear to be eccentric in opinion, for every opinion now accepted was once eccentric.
- Bertrand Russell

GBog
Posts: 114
Joined: Fri Jun 01, 2007 4:57 pm UTC

### Re: calculating Sols Orbit

Assuming there are no external forces on the solar system, total momentum is conserved. Choosing the simplest reference system - that is, the one which follows the solar system's center of mass - you can set
$\sum \vec{p} =0$
Since you know every planet's mass and initial velocity, and the sun's mass, it is a simple matter to find out the sun's initial velocity.

But Mercury being flung out to Venus sounds more like a problem of too few steps per time interval than a problem with the sun's inital velocity.

btilly
Posts: 1877
Joined: Tue Nov 06, 2007 7:08 pm UTC

### Re: calculating Sols Orbit

First thought that comes to mind for what you want is that you can use Newton's method in any number of dimensions to solve for what set of initial conditions makes a given error function as small as possible. And that error function can be, for instance, the sum of squares of all of the errors in your observations. In the case of modeling a solar system you'll need to "run the solar system" many times, and sensitivity to initial conditions will make the solution extremely numerically fiddly.

My understanding is that this is essentially the technique which has been used to come up with the best current estimates of the masses of the Solar system. In particular when you combine accurate current measurements with measurements of where things were made by the ancients, the extreme sensitivity to initial conditions leads to very accurate estimates of exactly where the planets are and how much they weigh.

Ironically some of the best observations for this purpose were made by the ancient Chinese in their attempts to figure out when a famous historical conjunction of planets took place. They never figured out the answer, but their records of planetary positions 3000 years ago allow us to project the Solar system accurately enough to find that it happened on March 5, 1953 B.C.. See http://lalaland.cl.msu.edu/~vanhoose/astro/0001.html for more.
Some of us exist to find out what can and can't be done.

Others exist to hold the beer.

siu00cp3
Posts: 5
Joined: Mon Apr 28, 2008 7:46 pm UTC
Location: England
Contact:

### Re: calculating Sols Orbit

GBog wrote:Assuming there are no external forces on the solar system, total momentum is conserved. Choosing the simplest reference system - that is, the one which follows the solar system's center of mass - you can set
$\sum \vec{p} =0$
Since you know every planet's mass and initial velocity, and the sun's mass, it is a simple matter to find out the sun's initial velocity.

But Mercury being flung out to Venus sounds more like a problem of too few steps per time interval than a problem with the sun's inital velocity.

It's not that simple to sort out the velocity, or at least not in my experience. It's not enough to know the speed at time t for this problem, you have to know it at t-1 in order to correctly find t, due to the need to take previous velocity into account. I don't have this problem with most planets/asteroids and such, since I have t from ephemora. This is what's causing me difficulty.
Step size isn't the problem. The experiment in question ran Runge Kutta 4th Order Integration with ten second intervals. I've found that when it comes to keeping things in place, I can go up to half an hour step sizes (except for some Moons).

Jupiters the big problem with dislodging Sol. It's tug seems to be what causes the disruption anyway..
Do not fear to be eccentric in opinion, for every opinion now accepted was once eccentric.
- Bertrand Russell

btilly
Posts: 1877
Joined: Tue Nov 06, 2007 7:08 pm UTC

### Re: calculating Sols Orbit

How much numerical precision are you using in your calculations?

I would wonder in particular whether the sudden jumps in the position of Sol due to round-off error could be what is adding energy to Mercury's orbit. And the relevance of Jupiter is that it makes those jumps happen more often. In which case changing step size really would not help.
Some of us exist to find out what can and can't be done.

Others exist to hold the beer.

siu00cp3
Posts: 5
Joined: Mon Apr 28, 2008 7:46 pm UTC
Location: England
Contact:

### Re: calculating Sols Orbit

btilly wrote:How much numerical precision are you using in your calculations?

I would wonder in particular whether the sudden jumps in the position of Sol due to round-off error could be what is adding energy to Mercury's orbit. And the relevance of Jupiter is that it makes those jumps happen more often. In which case changing step size really would not help.

I'm using doubles, either on 32 or 64 bit machines. The increase in energy is due to Sol moving over time, over quite a few years, it's a very slow drift. I need to model over several centuries to test some orbits though, like long period comets, so this is a problem. Mercury shifts from it's orbit quite slowly, and as it happens, maintains more or less the correct distance from Sol for quite a while, but goes astray as it nears the other planets. Venus follows, but enters a far more elliptical orbit. By this point Sol is irretrievably out of position, and everythings ruined (I should have done a time series to show this, bad, bad scientist...)

The same should happen to the Earth moon system if it can happen with Sol (I think, not certain about this), and it doesn't. I'm pretty certain it's due to bad starting conditions. I know that can be fatal for my software, since I have, for example, as yet not managed to model the Galilean Moons so they conform to an exact date. I can give them average positions, and that works, but then it becomes useless for the sort of simulations I'm doing.
Do not fear to be eccentric in opinion, for every opinion now accepted was once eccentric.
- Bertrand Russell

nsmjohn
Posts: 580
Joined: Tue Mar 04, 2008 11:42 pm UTC
Location: California

### Re: calculating Sols Orbit

siu00cp3 wrote:
btilly wrote:How much numerical precision are you using in your calculations?

I would wonder in particular whether the sudden jumps in the position of Sol due to round-off error could be what is adding energy to Mercury's orbit. And the relevance of Jupiter is that it makes those jumps happen more often. In which case changing step size really would not help.

I'm using doubles, either on 32 or 64 bit machines. The increase in energy is due to Sol moving over time, over quite a few years, it's a very slow drift. I need to model over several centuries to test some orbits though, like long period comets, so this is a problem. Mercury shifts from it's orbit quite slowly, and as it happens, maintains more or less the correct distance from Sol for quite a while, but goes astray as it nears the other planets. Venus follows, but enters a far more elliptical orbit. By this point Sol is irretrievably out of position, and everythings ruined (I should have done a time series to show this, bad, bad scientist...)

The same should happen to the Earth moon system if it can happen with Sol (I think, not certain about this), and it doesn't. I'm pretty certain it's due to bad starting conditions. I know that can be fatal for my software, since I have, for example, as yet not managed to model the Galilean Moons so they conform to an exact date. I can give them average positions, and that works, but then it becomes useless for the sort of simulations I'm doing.

What software are you using to model this? Is it self designed?
Gojoe wrote:Well, I would say something here, but it would only make it worse.

btilly
Posts: 1877
Joined: Tue Nov 06, 2007 7:08 pm UTC

### Re: calculating Sols Orbit

Double precision floating point is an IEEE standard and should behave the same on 32 and 64 bit machines. In particular you get 52 bits to specify the fractional part. That is a dynamic range of 4.50*1015. Considering that the Sun weighs about 6 million times as much as Mercury, and gravity is numerically unstable, I can well believe that roundoff errors add up. The reason you don't see it when take the Sun out is that the Sun is 99% of the total mass, making the relative error of that roundoff error 100 times as big when you include the Sun. Therefore you see problems 100 times as fast.

I would suggest solving it either by moving to even higher precision arithmetic or by forcibly asserting the average position and mass of the Solar system. If you take the latter approach, in each iteration if the total momentum or position of the Solar system differs from 0, then update the position and velocity of the Sun to correct for that.

As for the Galilean moons, you'd have to talk to an expert. But I wouldn't be surprised if either that system was chaotic, or if tidal forces have a noticible impact. (An ellipsoid is not gravitationally the same as a sphere.)

If you need to model the moons of Saturn, then I know you're hosed. The moon Hyperion is famously in an extremely chaotic orbit - the time for subatomic differences to migrate up to tens of km is about 10 years IIRC. Good luck modeling that one!
Some of us exist to find out what can and can't be done.

Others exist to hold the beer.

siu00cp3
Posts: 5
Joined: Mon Apr 28, 2008 7:46 pm UTC
Location: England
Contact:

### Re: calculating Sols Orbit

nsmjohn wrote:
What software are you using to model this? Is it self designed?

Yes, I use it for experiments myself, and have it in the wild an open source project as well.
Do not fear to be eccentric in opinion, for every opinion now accepted was once eccentric.
- Bertrand Russell

siu00cp3
Posts: 5
Joined: Mon Apr 28, 2008 7:46 pm UTC
Location: England
Contact:

### Re: calculating Sols Orbit

btilly wrote:Double precision floating point is an IEEE standard and should behave the same on 32 and 64 bit machines. In particular you get 52 bits to specify the fractional part. That is a dynamic range of 4.50*1015. Considering that the Sun weighs about 6 million times as much as Mercury, and gravity is numerically unstable, I can well believe that roundoff errors add up. The reason you don't see it when take the Sun out is that the Sun is 99% of the total mass, making the relative error of that roundoff error 100 times as big when you include the Sun. Therefore you see problems 100 times as fast.

I hadn't realised that. I'll have to see if I can find if this is whats happening.

btilly wrote:If you need to model the moons of Saturn, then I know you're hosed. The moon Hyperion is famously in an extremely chaotic orbit - the time for subatomic differences to migrate up to tens of km is about 10 years IIRC. Good luck modeling that one!

Urk, that was my next plan. Well I'll just have to try them one at a time and keep the ones that work. I will need to derive their masses first, which isn't too hard as I'm being lazy and using a GA.
Do not fear to be eccentric in opinion, for every opinion now accepted was once eccentric.
- Bertrand Russell

Seraph
Posts: 343
Joined: Mon Jul 16, 2007 4:51 pm UTC

### Re: calculating Sols Orbit

If you need to model the moons of Saturn, then I know you're hosed. The moon Hyperion is famously in an extremely chaotic orbit - the time for subatomic differences to migrate up to tens of km is about 10 years IIRC. Good luck modeling that one!

Do you have a citation for this? I looked around and was able to find all sorts of references to Hyperion's rotation being chaotic, but none to its orbit being chaotic.

Robin S
Posts: 3579
Joined: Wed Jun 27, 2007 7:02 pm UTC
Location: London, UK
Contact:

### Re: calculating Sols Orbit

Indeed, Wikipedia mentions a 3:4 orbital resonance with Titan, which would imply the opposite.
This is a placeholder until I think of something more creative to put here.

btilly
Posts: 1877
Joined: Tue Nov 06, 2007 7:08 pm UTC

### Re: calculating Sols Orbit

Seraph wrote:
If you need to model the moons of Saturn, then I know you're hosed. The moon Hyperion is famously in an extremely chaotic orbit - the time for subatomic differences to migrate up to tens of km is about 10 years IIRC. Good luck modeling that one!

Do you have a citation for this? I looked around and was able to find all sorts of references to Hyperion's rotation being chaotic, but none to its orbit being chaotic.

I was definitely confusing the two. Sorry.
Some of us exist to find out what can and can't be done.

Others exist to hold the beer.

Cosmologicon
Posts: 1806
Joined: Sat Nov 25, 2006 9:47 am UTC
Location: Cambridge MA USA
Contact:

### Re: calculating Sols Orbit

When I tried to do 4th-order Runge-Kutta for N-body simulations, I initially overlooked the fact that the 4th derivative of an object's position depends not only on its own acceleration, but on the accelerations of all the other bodies attracting it. So you need to do a two-pass calculation, getting acceleration and jerk for all the bodies on the first pass, then getting the snap for them on the second pass. Now, you probably already knew that, but I made that mistake so I just thought I'd point it out.

You might consider a more sophisticated technique than 4th-order Runge-Kutta. I haven't tried to implement anything from this page yet, but it looks pretty thorough and the guy's applet runs great.

Cosmologicon
Posts: 1806
Joined: Sat Nov 25, 2006 9:47 am UTC
Location: Cambridge MA USA
Contact:

### Re: calculating Sols Orbit

Hey siu00cp3, did you ever get this fixed? I'd be very curious to hear how you solved this problem.