Ex: Nonlinearity messes up a linear center (borderline case)

Phase portraits (in the Cartesian coordinates)

Clear[diffX,diffY,x,y,a]
linX=-y;
linY=x;
diffX=-y+a x (x^2+y^2);
diffY=x+a y (x^2+y^2);

fixdp=Graphics[{PointSize[0.03],Red,Point[{0,0}]}];
linP=StreamPlot[{linX,linY},{x,-2,2},{y,-2,2},FrameLabel->{x[t],y[t]},PlotLabel->Style["Linear system",Large],ImageSize->400,LabelStyle->20];
aP=StreamPlot[{diffX/.a->1,diffY/.a->1},{x,-2,2},{y,-2,2},FrameLabel->{x[t],y[t]},PlotLabel->Style["Nonlinear system a > 0",Large],ImageSize->400,LabelStyle->20];
aO=StreamPlot[{diffX/.a->0,diffY/.a->0},{x,-2,2},{y,-2,2},FrameLabel->{x[t],y[t]},PlotLabel->Style["Nonlinear system a = 0",Large],ImageSize->400,LabelStyle->20];
aN=StreamPlot[{diffX/.a->-1,diffY/.a->-1},{x,-2,2},{y,-2,2},FrameLabel->{x[t],y[t]},PlotLabel->Style["Nonlinear system a < 0",Large],ImageSize->400,LabelStyle->20];
Grid[{{Show[linP,fixdp],Show[aO,fixdp]},{Show[aP,fixdp],Show[aN,fixdp]}},Frame->All]

Numerical solution and phase portrait (interactive)

Clear[diffX,diffY,x,y,a]
imagesize=390;maxT=25;

Manipulate[
diffX=-y+a x (x^2+y^2);
diffY=x+a y (x^2+y^2);
difX=diffX/.{x->x[t],y->y[t]};
difY=diffY /.{x->x[t],y->y[t]};
splot=StreamPlot[{diffX,diffY},{x,-1,1},{y,-1,1},FrameLabel->{x[t],y[t]},LabelStyle->18,ImageSize->imagesize];
fixedpoints=Quiet[Solve[{diffX==0,diffY==0},{x,y}]];
coordinates={x,y}/.fixedpoints;
fixedp=Graphics[{PointSize[0.03],Black,Point[coordinates]}];
integration=NDSolve[{
x'[t]==difX,
y'[t]==difY,
x[0]==point[[1]],y[0]==point[[2]]},
{x,y},{t,0,T}];
trajectory=ParametricPlot[Evaluate[{x[t],y[t]}/.integration],{t,0,T},PlotStyle->Black];
solx=Plot[Evaluate[x[t]/.integration],{t,0,T},PlotRange-> All,AxesLabel-> {t,x[t]},LabelStyle->18,PlotLabel->"Displacement",ImageSize->imagesize,PlotStyle->Black];
soly=Plot[Evaluate[y[t]/.integration],{t,0,T},PlotRange-> All,AxesLabel-> {t,y[t]},LabelStyle->18,PlotLabel->"Velocity",ImageSize->imagesize,PlotStyle->Black];
Grid[{{Show[splot,trajectory,fixedp],soly},{solx}},Frame->All],
{{T,0.5 maxT,"Intergation time, t"},1,maxT,Appearance->"Labeled"},
{{a,0,"Parameter a"},-0.4,0.1,Appearance->"Labeled"},{{point,{0,0.5}},Locator}, SaveDefinitions->True,TrackedSymbols:>{T,a,point}]

Creation of this notebook was supported by IT Academy program of Information Technology Foundation for Education (HITSA).