Example 3.2: Unstable Manifold (Ch 3, page 52)

Clear["Global`*"]
Off[General::spell1]

System

Parameters

{(Subscript[x, min]),(Subscript[x, max])}={-4,4};
{(Subscript[y, min]),(Subscript[y, max])}={-5,5};

f[x_,y_]:=x

g[x_,y_]:=-y + (x^2)

Vector field

V={f[x,y],g[x,y]}

Fixed Points & Nullclines

fp=Solve[{f[(Subscript[x, 1]),(Subscript[y, 1])]==0,g[(Subscript[x, 1]),(Subscript[y, 1])]==0},{(Subscript[x, 1]),(Subscript[y, 1])}]

fp1=Sort[fp[[1]]];

{(Subscript[x, 1]),(Subscript[y, 1])}={Extract[fp1,{1}][[2]],Extract[fp1,{2}][[2]]};
fixedpoint1=Show[Graphics[{PointSize[0.025],Hue[0.33],Point[{(Subscript[x, 1]),(Subscript[y, 1])}]},PlotRange->{{(Subscript[x, min]),(Subscript[x, max])},{(Subscript[y, min]),(Subscript[y, max])}}]];

nullclines=ContourPlot[{f[x,y]==0,g[x,y]==0},{x,(Subscript[x, min]),(Subscript[x, max])},{y,(Subscript[y, min]),(Subscript[y, max])},ContourStyle->{{Green,Thickness[0.005]}}];

Show[nullclines,fixedpoint1]

Jacobian

a11=Simplify[D[f[x,y],x]]

a12=Simplify[D[f[x,y],y]]

a21=Simplify[D[g[x,y],x]]

a22=Simplify[D[g[x,y],y]]

J={{a11,a12},{a21,a22}}

MatrixForm[J]

Acceleration

γ=J . V

Fixed Points Stability - Eigenvalues

Eigenvalues[J]/.{x-> (Subscript[x, 1]),y->(Subscript[y, 1])}

Phase Portrait

x=.
y=.
t=.

solution=NDSolve[{x'[t]==f[x[t],y[t]],x[0]==.1,

y'[t]==g[x[t],y[t]],y[0]==5},{x,y},

{t,0,60},Method->"ExplicitRungeKutta", MaxSteps->Infinity,StartingStepSize->0.001];phaseplot=ParametricPlot[Evaluate[{x[t],y[t]}/.solution],{t,0,60},PlotPoints->1000,PlotRange->{{(Subscript[x, min]),(Subscript[x, max])},{(Subscript[y, min]),(Subscript[y, max])}},AxesLabel->{"X","Y"},PlotStyle->{{Red,Thickness[0.005]}},AspectRatio->1,Frame->True];

tableplot={};
For[t=0,t≤3.5,t=t+ .5,
x=Evaluate[{x[t],y[t]}/.solution][[1]][[1]];
y=Evaluate[{x[t],y[t]}/.solution][[1]][[2]];
vx=f[x,y];
vy=g[x,y];
tmptable={{x,y},{vx,vy}};
tableplot=Append[tableplot,tmptable];];
flow=ListVectorFieldPlot[tableplot ,ScaleFunction->(.25&),ColorFunction->(Hue[0.66]&),Frame->True,AspectRatio->1];

x=.
y=.
t=.

solution=NDSolve[{x'[t]==f[x[t],y[t]],x[0]==-.1,

y'[t]==g[x[t],y[t]],y[0]==5},{x,y},

{t,0,60},Method->"ExplicitRungeKutta", MaxSteps->Infinity,StartingStepSize->0.001];phaseplot1=ParametricPlot[Evaluate[{x[t],y[t]}/.solution],{t,0,60},PlotPoints->1000,PlotRange->{{(Subscript[x, min]),(Subscript[x, max])},{(Subscript[y, min]),(Subscript[y, max])}},AxesLabel->{"X","Y"},PlotStyle->{{Red,Thickness[0.005]}},AspectRatio->1,Frame->True];

tableplot={};
For[t=0,t≤3.5,t=t+ .5,
x=Evaluate[{x[t],y[t]}/.solution][[1]][[1]];
y=Evaluate[{x[t],y[t]}/.solution][[1]][[2]];
vx=f[x,y];
vy=g[x,y];
tmptable={{x,y},{vx,vy}};
tableplot=Append[tableplot,tmptable];];
flow1=ListVectorFieldPlot[tableplot ,ScaleFunction->(.25&),ColorFunction->(Hue[0.66]&),Frame->True,AspectRatio->1];

x=.
y=.
t=.

solution=NDSolve[{x'[t]==f[x[t],y[t]],x[0]==.1,

y'[t]==g[x[t],y[t]],y[0]==-5},{x,y},

{t,0,60},Method->"ExplicitRungeKutta", MaxSteps->Infinity,StartingStepSize->0.001];phaseplot2=ParametricPlot[Evaluate[{x[t],y[t]}/.solution],{t,0,60},PlotPoints->1000,PlotRange->{{(Subscript[x, min]),(Subscript[x, max])},{(Subscript[y, min]),(Subscript[y, max])}},AxesLabel->{"X","Y"},PlotStyle->{{Red,Thickness[0.005]}},AspectRatio->1,Frame->True];

tableplot={};
For[t=0,t≤3.5,t=t+ .5,
x=Evaluate[{x[t],y[t]}/.solution][[1]][[1]];
y=Evaluate[{x[t],y[t]}/.solution][[1]][[2]];
vx=f[x,y];
vy=g[x,y];
tmptable={{x,y},{vx,vy}};
tableplot=Append[tableplot,tmptable];];
flow2=ListVectorFieldPlot[tableplot ,ScaleFunction->(.25&),ColorFunction->(Hue[0.66]&),Frame->True,AspectRatio->1];

x=.
y=.
t=.

solution=NDSolve[{x'[t]==f[x[t],y[t]],x[0]==-.1,

y'[t]==g[x[t],y[t]],y[0]==-5},{x,y},

{t,0,60},Method->"ExplicitRungeKutta", MaxSteps->Infinity,StartingStepSize->0.001];phaseplot3=ParametricPlot[Evaluate[{x[t],y[t]}/.solution],{t,0,60},PlotPoints->1000,PlotRange->{{(Subscript[x, min]),(Subscript[x, max])},{(Subscript[y, min]),(Subscript[y, max])}},AxesLabel->{"X","Y"},PlotStyle->{{Red,Thickness[0.005]}},AspectRatio->1,Frame->True];

tableplot={};
For[t=0,t≤3.5,t=t+ .5,
x=Evaluate[{x[t],y[t]}/.solution][[1]][[1]];
y=Evaluate[{x[t],y[t]}/.solution][[1]][[2]];
vx=f[x,y];
vy=g[x,y];
tmptable={{x,y},{vx,vy}};
tableplot=Append[tableplot,tmptable];];
flow3=ListVectorFieldPlot[tableplot ,ScaleFunction->(.25&),ColorFunction->(Hue[0.66]&),Frame->True,AspectRatio->1];

x=.
y=.
t=.

solution=NDSolve[{x'[t]==f[x[t],y[t]],x[0]==0,

y'[t]==g[x[t],y[t]],y[0]==-5},{x,y},

{t,0,60},Method->"ExplicitRungeKutta", MaxSteps->Infinity,StartingStepSize->0.001];phaseplot4=ParametricPlot[Evaluate[{x[t],y[t]}/.solution],{t,0,60},PlotPoints->1000,PlotRange->{{(Subscript[x, min]),(Subscript[x, max])},{(Subscript[y, min]),(Subscript[y, max])}},AxesLabel->{"X","Y"},PlotStyle->{{Green,Thickness[0.005]}},AspectRatio->1,Frame->True];

tableplot={};
For[t=0,t≤3.5,t=t+ .5,
x=Evaluate[{x[t],y[t]}/.solution][[1]][[1]];
y=Evaluate[{x[t],y[t]}/.solution][[1]][[2]];
vx=f[x,y];
vy=g[x,y];
tmptable={{x,y},{vx,vy}};
tableplot=Append[tableplot,tmptable];];
flow4=ListVectorFieldPlot[tableplot ,ScaleFunction->(.25&),ColorFunction-> None,Frame->True,AspectRatio->1];

x=.
y=.
t=.

solution=NDSolve[{x'[t]==f[x[t],y[t]],x[0]==0,

y'[t]==g[x[t],y[t]],y[0]==5},{x,y},

{t,0,60},Method->"ExplicitRungeKutta", MaxSteps->Infinity,StartingStepSize->0.001];phaseplot5=ParametricPlot[Evaluate[{x[t],y[t]}/.solution],{t,0,60},PlotPoints->1000,PlotRange->{{(Subscript[x, min]),(Subscript[x, max])},{(Subscript[y, min]),(Subscript[y, max])}},AxesLabel->{"X","Y"},PlotStyle->{{Green,Thickness[0.005]}},AspectRatio->1,Frame->True];

tableplot={};
For[t=0,t≤3.5,t=t+ .5,
x=Evaluate[{x[t],y[t]}/.solution][[1]][[1]];
y=Evaluate[{x[t],y[t]}/.solution][[1]][[2]];
vx=f[x,y];
vy=g[x,y];
tmptable={{x,y},{vx,vy}};
tableplot=Append[tableplot,tmptable];];
flow5=ListVectorFieldPlot[tableplot ,ScaleFunction->(.25&),ColorFunction-> None,Frame->True,AspectRatio->1];

x=.
y=.
t=.

Show[phaseplot,flow,phaseplot1,flow1,phaseplot2,flow2,phaseplot3,flow3,phaseplot4,flow4,phaseplot5,flow5,fixedpoint1,nullclines]

vectorfield=VectorFieldPlot[{f[x,y],g[x,y]},{x,(Subscript[x, min]),(Subscript[x, max])},{y,(Subscript[y, min]),(Subscript[y, max])},PlotPoints->20 ,ScaleFunction->(.25&),ColorFunction->(Hue[0.66]&),Frame->True,Axes->True,AxesLabel->{"X","Y"},AspectRatio->1]

Flow Curvature Manifold

ϕ=FullSimplify[Det[{V,γ}]]

ϕ=y-((x^2)/3)

flowmanifold=ContourPlot[{y==0},{x,(Subscript[x, min]),(Subscript[x, max])},{y,(Subscript[y, min]),(Subscript[y, max])},ContourStyle->{{Blue,Thickness[0.005]}},AspectRatio->1,Frame->True]

flowmanifold=ContourPlot[{ϕ==0},{x,(Subscript[x, min]),(Subscript[x, max])},{y,(Subscript[y, min]),(Subscript[y, max])},ContourStyle->{{Blue,Thickness[0.005]}},AspectRatio->1,Frame->True]

x=.
y=.
t=.

phaseplotU=ParametricPlot[Evaluate[{t,t^2/3}],{t,-60,60},PlotPoints->1000,PlotRange->{{(Subscript[x, min]),(Subscript[x, max])},{(Subscript[y, min]),(Subscript[y, max])}},AxesLabel->{"X","Y"},PlotStyle->{{Blue,Thickness[0.005]}},AspectRatio->1,Frame->True]

tableplot={};
For[t=-3.5,t≤3.5,t=t+ .5,
x=t;
y=t^2/3;
vx=x;
vy=-y + x^2;
tmptable={{x,y},{vx,vy}};
tableplot=Append[tableplot,tmptable];];
flowU=ListVectorFieldPlot[tableplot ,ScaleFunction->(.25&),ColorFunction->None,Frame->True,AspectRatio->1]

Flow Curvature Invariance

Normal Vector

η={D[ϕ,x],D[ϕ,y]}

Invariance

Ψ=FullSimplify[V . η]

FullSimplify[(Ψ/ϕ)]

Show[phaseplot,flow,phaseplot1,flow1,phaseplot2,flow2,phaseplot3,flow3,phaseplot4,flow4,phaseplot5,flow5,phaseplotU,flowU,fixedpoint1,ImageSize->{600,600}]