<p>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.</p>

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

<p>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.</p>

<p>The distances you have for the size of the obit scale like this :</p>

<p>$$r_1 = \frac \mu m_1 r$$</p>

<p>$$r_2 = \frac \mu m_2 r$$</p>

<p>where $\mu$ is the reduced mass :</p>

<p>$$\mu = \frac { m_1 m_2 } { m_1 + m_2 }$$</p>

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

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

<p>The mathematics comes from the way the standard <a href="https://en.wikipedia.org/wiki/Two-body_problem" rel="nofollow noreferrer">two body problem</a> is solved.</p>

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

CC BY-SA 3.0
2017-01-09T13:16:27.180Z
2017-01-09T13:16:27.180Z
StephenG - Help Ukraine
<p>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 href="https://en.wikipedia.org/wiki/Orbital_elements" rel="nofollow noreferrer">A Keplerian orbit is merely an idealized, mathematical approximation at a particular time</a>". 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.</p>

<p>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 <a href="http://ssd.jpl.nasa.gov/horizons.cgi" rel="nofollow noreferrer">Horizons</a> and the python package <a href="http://rhodesmill.org/skyfield/" rel="nofollow noreferrer">Skyfield</a> but there are several other options. </p>

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

<p>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.</p>

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

<p>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 <em>would have been in the past</em> such that the gravity "signal" will have just arrived at your asteroid at the time reflected in your time step.</p>

<p>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.</p>

<p><a href="https://i.sstatic.net/NLHi6.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/NLHi6.png" alt="enter image description here"></a></p>

<p><a href="https://i.sstatic.net/4gEXM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4gEXM.png" alt="enter image description here"></a></p>

<pre><code>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:
    plt.figure()
    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)
    plt.show()

"""
# 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)
"""   
</code></pre>

CC BY-SA 3.0
2017-02-11T04:27:43.190Z
2017-02-11T04:27:43.190Z
uhoh
<p>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?</p>

<p>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. </p>

CC BY-SA 3.0
2017-02-11T04:28:14.070Z
I've left an answer, please check it and see if you need something more. You can also ask follow-up questions.
uhoh
<the-sun><orbital-elements>
Sun's orbital elements
abhishek
# Sun's orbital elements

(Asked by: username_0 on 2017-01-09)

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.

**Tags:** the-sun, orbital-elements
> **Comments:**
> **username_1**: I've left an answer, please check it and see if you need something more. You can also ask follow-up questions.  

---

## 2 answers

### Answer by username_2 on 2017-01-09. Score: 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](https://en.wikipedia.org/wiki/Two-body_problem) is solved.

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


---

### Answer by username_1 on 2017-02-11. Score: 1

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.


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:
    plt.figure()
    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)
    plt.show()

"""
# 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)
"""


---

