Welcome to our community

Be a part of something great, join today!

[SOLVED] 3 body problem

dwsmith

Well-known member
Feb 1, 2012
1,673
I used mathematica to solve a restricted 3 body problem and was able to export my position data at different time intervals. How can I find my velocity at that final location?
 

Ackbach

Indicium Physicus
Staff member
Jan 26, 2012
4,192
What mechanism did you employ in Mathematica to get your position object? NDSolve? If so, you should be able to differentiate it numerically by using the usual D[] function.
 

dwsmith

Well-known member
Feb 1, 2012
1,673
What mechanism did you employ in Mathematica to get your position object? NDSolve? If so, you should be able to differentiate it numerically by using the usual D[] function.
I obtained my position data by
Code:
XYdata = Flatten[
   Table[Evaluate[{x1[t], x2[t], x3[t]} /. s], {t, 0, 122400, 3}], 1];
SetDirectory[NotebookDirectory[]];
Export["OrbitData.txt", XYdata, "CSV"];
Earth = {N[x1], 0};
L4 = {N[xL4], N[yL4]};
Export["Earth.txt", Earth, "CSV"];
 

Ackbach

Indicium Physicus
Staff member
Jan 26, 2012
4,192
So are you now looking at the data in Excel, or Mathematica? Because you should be able to do x1'[t]/.s to get the derivative in Mathematica. In Excel, you'd have to have the time data as well as the position data. Then you could compute a numerical derivative.
 

dwsmith

Well-known member
Feb 1, 2012
1,673
Here is the plot of my trajectory to L4.
The moon is the green dot in the bottom and Earth is blue.