0
$\begingroup$

I have this code of an orbit at a Lagrange Point of the Sun-Jupiter system

Alpha = 0.000953875;
r01[x_, y_] := Sqrt[(x - Alpha)^2 + y^2];
r02[x_, y_] := Sqrt[(x + 1 - Alpha)^2 + y^2];
x00 = -0.509;      
y00 = 0.883;
u00 = 0.0259;
v00 = 0.0149;
tmax = 600;


solution = NDSolve[{x'[t] == u[t], y'[t] == v[t], 
u'[t] == (-(1 - Alpha) (x[t] - Alpha))/r01[x[t], y[t]]^3 - (
  Alpha (x[t] + 1 - Alpha))/r02[x[t], y[t]]^3 + x[t] + 2 v[t],

v'[t] == -(((1 - Alpha) y[t])/r01[x[t], y[t]]^3 ) - (Alpha y[t])/
  r02[x[t], y[t]]^3 + y[t] - 2 u[t], 

x[0] == x00, y[0] == y00, 
u[0] == u00, v[0] == v00}, {x, y, u, v}, {t, 0, tmax}];

and i can manipulate said result with this code

Manipulate[ParametricPlot[Evaluate[{x[t], y[t]} /. solution], {t, 0, b}, 
PlotRange -> {{-0.9, -0.1}, {0.4, 1}}], {b, 0.01, 150}]

enter image description here

I also have a contour plot

plot1 = ContourPlot[-((1 - a)/Sqrt[(x - a)^2 + y^2]) - a/
Sqrt[(x + 1 - a)^2 + y^2] - 1/2 (x^2 + y^2), {x, -1.65, 
1.65}, {y, -1.65, 1.65}, AxesLabel -> {x, y}]

enter image description here

Using the Show command, i cant manage to put them together, it says "Could not combine the graphics objects in Show", how can i combine them?

$\endgroup$
1
$\begingroup$

It looks like you may have tried to combine ContourPlot with Manipulate. This will not work because Show cannot combine a Graphics object with a Manipulate object. Instead have Show inside Manipulate itself.

Manipulate[
 Show[plot1, 
  ParametricPlot[Evaluate[{x[t], y[t]} /. solution], {t, 0, b}, 
   PlotRange -> {{-0.9, -0.1}, {0.4, 1}}]], {b, 0.01, 150}]

BTW your code for ContourPlot does not have the value for a. I took a to be 1 just to check.

$\endgroup$
  • $\begingroup$ YES! Thank you so much! You're right, i forgot the value of a ,it was 0.001. Say, you helped me to show one orbit in that ContourPlot, i have other 4 solutions that cover other 4 areas of said ContourPlot, named "solution1, solution2, etc,.." How do i plot them altogether each, with its manipulate, in the ContourPlot? Should i make a list of 4 ParametricPlots? $\endgroup$ – Hector Manuel Chacon Carrillo Sep 25 '18 at 2:11
  • $\begingroup$ It seems like you can solve the equations to get all 4 solutions and plot them all together using one ParametricPlot. and Use ContourPlot to show the contours. Manipuate can be wrapped Show as before. $\endgroup$ – Lotus Sep 25 '18 at 2:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.