# Differential equation in two variables

I have a system of second order differential equations, with two independent variables, which represents a trajectory. I tried solving this system using NDSolve and it gave me something like this:

{{x[t] -> 9 InterpolatingFunction[{{0., 1. 10 }}, <>][t],
y[t] -> 9 InterpolatingFunction[{{0., 1. 10 }}, <>][t]}}


With this result, I tried plotting the trajectory Plot, but it doesn't show anything. Can you help me visualize the trajectory? Here is my entire code:

m = 4.5;
S = 5.6^2;
T = 5.972 10^24;
L = 7.35 10^22;
G  = 6.67 10^-11;
K = (5.6^2 *(3.42 10^21)*(3.98 10^-19))/(3 10^8);
d = 3.84 10^8;
r = 0.9;
s = 0.9;

mySystem = {x''[t] == -((x[t]*G*T)/(x[t]^2 + y[t]^2)^((3/2))) - (x[t]*G*L)/(x[t]^2 + y[t]^2)^(3/2), y''[t] == -(y[t]*G*T)/(x[t]^2 + y[t]^2)^(3/2) - ((d - y[t])*G*L)/(x[t]^2 + (d - y[t]^2))^(3/2)};

myUnknowns = {x[t], y[t]};

myConditions = {x == 0, y == 3.58 10^7, x' == 3074, y' == 0, x'' == 0, y'' == 0};

traj = NDSolve[{mySystem, myConditions}, myUnknowns, {t, 0, 10^9}]

Plot[{x[t] /. traj, y[t] /. traj}, {t, 0, 10^9}]

• I get errors on your code, is something missing? Jan 5, 2016 at 14:17
• @Blop: Delete the $x'', y''$ initial conditions, for the first error, which then allows the code to run. Change your plot range from $10^9$ to $10^2$ to see what is happening. In other words, your results are impacting plotting over the entire range.
– Moo
Jan 5, 2016 at 14:18
• In addition to @Variable recommendations use LogLogPlot, i.e., LogLogPlot[{x[t] /. traj, y[t] /. traj}, {t, 10^-6, 100}, PlotRange -> All, PlotLegends -> {x[t], y[t]}] to see issue more clearly. Jan 5, 2016 at 14:49

I eliminated the bad initial conditions as suggested by Variable and reduced the range of to $[0,30]$ and solved the equations with NDSolve and extracted the interpolating functions with

xF = Head[traj[[1, 1, 2]]];


Then I made the following table.

({#, xF[#], yF[#]}& /@ Range) // Chop // TableForm I think the table explains what is going wrong. The OP's error is in the formulation of his equations.

• Thank you for your answer. Can you help me Plot the trajectory
– user36730
Jan 11, 2016 at 16:17