I have the orbital elements of an asteroid's heliocentric motion (the orbit has non-zero inclination and is elliptical). But I want to simulate the motion of the sun around the asteroid. So without having the sun's ephemeris, and given only the asteroid's orbital elements, how can I determine an equivalent orbital elements for the sun's motion around the asteroid?

Edit: I realize that the question wasn't clear enough based on the comment. So, what I am trying to do is to numerically solve the two body problem equation in the inertial frame. In the classic two-body problem 2nd order ODE, in my case, the position vector is defined from the centre of the asteroid to the sun, which is absolutely valid and upon integration gives me the position an velocity for the sun with respect to an inertial frame centred at the asteroid. My question is concerned with the initial conditions to begin the numerical integration. As of now I determine the initial state vector for the Sun from some random orbital elements. But to perform a more realistic simulation, Is it possible to determine the real orbital elements for the asteroid-centric motion of the Sun from a given set of orbital elements of a heliocentric-motion of the asteroid? I hope I was clear and not made this more confusing.

  • 2
    $\begingroup$ Unless I'm seriously missing the point, the Sun's position with respect to the asteroid will be the negative vector of the asteroid's position with respect to the Sun. Are you just asking for the orbital elements of this fairly minor frame change? $\endgroup$
    – user21
    Commented Jan 9, 2017 at 15:06
  • $\begingroup$ I've left an answer, please check it and see if you need something more. You can also ask follow-up questions. $\endgroup$
    – uhoh
    Commented Feb 11, 2017 at 4:28

2 Answers 2


Strictly speaking the Sun's motion is going to be dominated by the gas giants and the planets and one asteroid is going to have negligible effect on it compared to those.

However if we assume there are no other items we can get an approximate idea of the effect.

You can use the similarity of the orbits. The Sun ( in this simplified model ) follows a complimentary orbit around the center of mass of the two bodies.

The distances you have for the size of the obit scale like this :

$$r_1 = \frac \mu m_1 r$$

$$r_2 = \frac \mu m_2 r$$

where $\mu$ is the reduced mass :

$$\mu = \frac { m_1 m_2 } { m_1 + m_2 }$$

And as you can see $r = r_1 + r_2$ is the distance between the two bodies.

Now as you can see from those equations, the most massive body moves the least.

The mathematics comes from the way the standard two body problem is solved.

It might be instructive for you to compare the effect of your asteroid to that of Jupiter or Earth.


This is a really good question. Any attempt at a good answer requires breaking the news that in a realistic solar system with some big planets "A Keplerian orbit is merely an idealized, mathematical approximation at a particular time". If you are writing a computer program and not using ink, feathers, and parchment, it's best to just integrate the appropriate ODEs for the six element state vectors ($x, y, z, v_x, v_y, v_z$) of each body in question.

There are several ways to do this. You can use an ephemeris to get the state vectors at one moment in time (set up initial conditions) and integrate yourself, or you can get tables of positions of everything besides your asteroid and interpolate them. Two examples of resources for these are NASA JPL's Horizons and the python package Skyfield but there are several other options.

You can do some looking around here and in the Space Exploration stackexchange sites for tags for those.

The sun's motion relative to the solar system's center of mass is not a simple orbit, but reflects the motion of (primarily) Jupiter, Saturn, Uranus and Neptune, and the only way to get it right is to either calculate all of them yourself, or use a pre-calculated ephemeris.

These are necessary both to get the position of the sun correctly, and to calculate the gravitational effects of those planets on your asteroid!

Remember though, that gravity travels at the speed of light, so if you want to do precise calculations you have to at least make a first order approximation at each time step to where the planet would have been in the past such that the gravity "signal" will have just arrived at your asteroid at the time reflected in your time step.

Here's an example of the sun's motion with python. Dashed lines represent the equatorial radius of the sun - the motion regularly moves beyond one solar radius from the solar system center of mass.

enter image description here

enter image description here

import numpy as np
import matplotlib.pyplot as plt
from skyfield.api import Loader

load = Loader('~/Documents/fishing/SkyData')

data = load('de405.bsp')  # this one is big, de421 is smaller but more limited years
ts   = load.timescale()

years  = np.arange(1980, 2030, 0.1, dtype=float)

times  = ts.utc(years, 1, 1)

sun    = data['sun']

sunpos = sun.at(times).ecliptic_position().km

sunlims = 695700. * np.array([-1, 1])[:, None] * np.ones_like(years)

if 1 == 1:
    for thing in sunpos:
        plt.plot(years, 1E-06*thing)
    plt.ylabel('millions of km', fontsize=16)
    plt.xlabel('year', fontsize=16)
    for sunlim in sunlims:
        plt.plot(years, 1E-06*sunlim, '--k')
    plt.title('J2000 ecliptic position of the Sun (x, y, z)', fontsize=16)

# you can save as a numpy or json file:

np.save('sunpos', sunpos)  # You can save as .npy if you want to

with open('sunpos.json', 'w') as outfile:
    json.dump(sunpos.round(1).tolist(), outfile)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .