# Plotting orbits of trajectories of bodies sharing the earth's orbit in coordinates centered at the barycenter of the solar system [closed]

I am attempting to try and plot the trajectories of a trio of satellites that are orbiting with the earth-moon system around the solar system's barycenter. Originally, I had the satellites in orbit around earth and then the solar system, but now I want to try plotting the satellites' trajectories in orbits where they are trailing the earth at a distance equivalent to one month of the earth's travel OR at a Lagrange point.

Basically I want the satellites to be trailing the earth at the position earth was a month before. I'm having difficulty figuring out how to determine that position. Also, I am pulling data from the files off the NASA website.

Any help would be greatly appreciated since I am an amateur both in physics and Mathematica.

Here's a portion of my code with me trying to graph the orbit at the end.

(nn is all the planets in the solar system)

myInitialVelocityDirectionUnitVectors =
{{-1, 0, 0},
RotationMatrix[4 θ, {0, 0, 1}].{-1, 0, 0},
RotationMatrix[8 θ, {0, 0, 1}].{-1, 0, 0}};

myInitialVelocityVectors =
myInitialVelocityMagnitude*myInitialVelocityDirectionUnitVectors;

myStartingPositionVectors =
Table[
Table[
myInitialDisplacementFromEarthAU[[jj]] + myTriangleDisplacements[[ss]][[jj]],
{jj, 1, 3}],
{ss, 1, Length[myItems]}];
myStartingVelocityMagnitudes =
Table[
Sqrt[
GinAU3dm2*(mearthkg/msunkg) /
(myStartingPositionVectors[[nn]].myStartingPositionVectors[[nn]])^(1/2)],
{nn, 1, Length[myMasses]}];
myStartingVelocityDirections =
Table[
Cross[{0, 0, 1}, myStartingPositionVectors[[nn]]] /
(Cross[{0, 0, 1}, myStartingPositionVectors[[nn]]] .
Cross[{0, 0, 1}, myStartingPositionVectors[[nn]]])^(1/2),
{nn, 1, 3}];
myStartingVelocityVectors =
Table[
myStartingVelocityMagnitudes[[nn]]*myStartingVelocityDirections[[nn]],
{nn, 1, Length[myMasses]}];
dmyInitialPositions =
Table[
Table[
dmyPositions[[ss]][[jj]][0] == myStartingPositionVectors[[ss]][[jj]],
{jj, 1, 3}], {ss, 1,
Length[myItems]}];
dmyInitialVelocities =
Table[
Table[
dmyPositions[[ss]][[jj]]'[0] == myStartingVelocityVectors[[ss]][[jj]],
{jj, 1, 3}],
{ss, 1, Length[myItems]}];
initialConditions = Flatten[{dmyInitialPositions,  myInitialVelocities}];
eqnsFinal = Flatten[{deomsNumerical, initialConditions}];
variablesToSolveFor =
Flatten[
Table[
Table[dmyPositions[[nn]][[jj]][t], {jj, 1, 3}],
{nn, 1, Length[myPositions]}]];
stopTime = 365 (*planetsMaxTime*);

times = {};
numericalSolution =
Monitor[
First[
NDSolve[eqnsFinal, variablesToSolveFor, {t, 0, stopTime},
MaxSteps -> Infinity,
EvaluationMonitor :> AppendTo[times, t],
StartingStepSize -> 0.1]],
Quiet @ ListPlot[times, Joined -> True]]


I originally posted this on Physics.SE, but it was recommended I post it here instead.

## closed as too broad by MarcoB, m_goldberg, LCarvalho, Itai Seggev, J. M. is away♦Jul 26 '17 at 7:17

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Could you boil down your code to a better defined question? It's unlikely that anybody will simply interpret and debug your code for you otherwise. – MarcoB Jul 10 '17 at 4:06
• I did some course-work in celestial mechanics many years ago. I seem to recall the orbits of bodies trailing the earth by approximately two months are pretty stable (Lagrange point), but bodies trailing by one month are quickly perturbed out of earth orbit. – m_goldberg Jul 10 '17 at 5:17
• @m_goldberg I thought about that too! But I still don't know how to incorporate that into my code any suggestions? – SSoltero Jul 10 '17 at 5:57
• No suggestions. You have an interesting project, but it's a big one and not easy, either. I am too busy with other matters to put in the time I would need to if I were to get involved. Sorry about that, but I wish you success. It should be fun project, but I suspect very time consuming. – m_goldberg Jul 10 '17 at 18:22
• Well, maybe one very general suggestion. Break your project into a series of hierarchically organized tasks. Develop bottom-up. Get the tasks at lower levels working before you move up the hierarchy. You will find it easier to get help here if you were to ask a question about an issue encountered in one the tasks. – m_goldberg Jul 10 '17 at 18:39