6
$\begingroup$

I'm trying to solve and plot the following in Mathematica:

eqns = {x'[t] == 
    x[t] - y[t] - 
     x[t] (x[t]^2 + y[t]^2) + (x[t] y[t])/Sqrt[x[t]^2 + y[t]^2], 
   y'[t] == 
    x[t] + y[t] - y[t] (x[t]^2 + y[t]^2) - 
     x[t]^2/Sqrt[x[t]^2 + y[t]^2]};
DSolve[eqns, {x, y}, t]

This is supposed to be an example of unstable attractor ODE. However, execution never ends and I don't manage to see the solution of the equation.

$\endgroup$
  • 1
    $\begingroup$ Try using NDSolve instead $\endgroup$ – b3m2a1 May 26 at 20:55
15
$\begingroup$

To visualize a 2D system, I would start with StreamPlot:

vf = {x', y'} /. First@Solve[eqns /. f_[t] :> f, {x', y'}]; (* strip the args *)
StreamPlot[vf, {x, -2, 2}, {y, -2, 2}]

Mathematica graphics

You can use StreamPoints to highlight the structure and Epilog to mark the attractor at $(1,0)$:

ics = {{{Cos[1/5], Sin[1/5]}, Red},
       {{0.5, 0}, Magenta}, {{1.5, 0.}, Magenta}};
StreamPlot[vf, {x, -2, 2}, {y, -2, 2},
 StreamPoints -> {Append[ics, Automatic]},
 Epilog -> {White, EdgeForm[Black], Disk[{1, 0}, 0.03]}]

Mathematica graphics

$\endgroup$
5
$\begingroup$
eqns = {x'[t] == 
    x[t] - y[t] - 
     x[t] (x[t]^2 + y[t]^2) + (x[t] y[t])/Sqrt[x[t]^2 + y[t]^2], 
   y'[t] == 
    x[t] + y[t] - y[t] (x[t]^2 + y[t]^2) - 
     x[t]^2/Sqrt[x[t]^2 + y[t]^2]};
sol = NDSolve[Join[{x[0]==1.5, y[0]==1.5}, eqns], {x, y}, {t, 0, 50}];
ParametricPlot[{x[t], y[t]}/.sol//Evaluate, {t, 0, 50}, PlotRange->All]

enter image description here

$\endgroup$

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.