Exercises 3.1.a
Exercises 3.1.a
For:=r+x-log(1+x)
x
i) Sketch the different vector field types that appear when you vary . We’re actually going to do this first the hard way, then the easier way.
r
Looking at the phase portrait for different values of we get the following.
r
In[]:=
finsol[r_]:=Select[(x/.NSolve[r+x-Log[1+x]0,x]),Head[#]Real&];GraphicsGridPartitionShowPlot[#+x-Log[1+x],{x,-5,6},AxesLabelEvaluate[Style[#,14]&/@{"x",""}],PlotLabel"r = "<>ToString[#],AxesOrigin{0,0}],Iffinsol[#]==={},ListPlot[{{10,10}}],IfMin[finsol[#]]<10,If#0,ShowGraphics[Circle[{0,0},0.2]],GraphicsDisk{0,0},0.2,,,Show[{Graphics[Disk[{finsol[#][[1]],0},0.2]],Graphics[Circle[{finsol[#][[2]],0},0.2]]}],Show[{Graphics[Disk[{finsol[#][[1]],0},0.2]],Graphics[Circle[{finsol[#][[2]],0},0.2]]}],If[finsol[#]==={},Graphics[{Thick,Arrow[{{-3,0},{3,0}}]}],{Graphics[{Thick,Arrow[{{-3,0},{Min[finsol[#]]-0.2,0}}],Arrow[{{Max[finsol[#]]-0.2,0},{Min[finsol[#]]+0.2,0}}],Arrow[{{Max[finsol[#]]+0.2,0},{3,0}}]}]}],PlotRange{{-3,3},{-3,3}},AspectRatio1&/@Range[-1,0.25,0.25],3,ImageSize1200,Spacings{-10,0},FrameAll//Quiet
x
π
2
-π
2
Out[]=
Now taking the arrows and fixed points alone and plotting them as a vector field:
In[]:=
rv=Range[-1.75,0.25,0.25]vfp=ShowShowIffinsol[#]==={},ListPlot[{{10,10}}],IfMin[finsol[#]]<10,If#0,ShowGraphics[Circle[{0,#},0.2]],GraphicsDisk{0,#},0.2,,,Show[{Graphics[Disk[{finsol[#][[1]],#},0.2]],Graphics[Circle[{finsol[#][[2]],#},0.2]]}],Show[{Graphics[Disk[{finsol[#][[1]],#},0.2]],Graphics[Circle[{finsol[#][[2]],#},0.2]]}],If[finsol[#]==={},Graphics[{Thick,Red,Arrow[{{-3,#},{3.5,#}}]}],{Graphics[{Thick,Red,Arrow[{{-3,#},{Min[finsol[#]]-0.2,#}}],Arrow[{{Max[finsol[#]]-0.2,#},{Min[finsol[#]]+0.2,#}}],Arrow[{{Max[finsol[#]]+0.2,#},{3.5,#}}]}]}],AspectRatio1&/@rv,PlotRange{{-2,3.5},{-2.5,1.5}},AspectRatio1,AxesLabelEvaluate[Style[#,14]&/@{"x","r"}],AxesTrue//Quiet
π
2
-π
2
Out[]=
{-1.75,-1.5,-1.25,-1.,-0.75,-0.5,-0.25,0.,0.25}
Out[]=
We get the bifurcation diagram by rotating this whole plot above:
In[]:=
Show[vfp/.Arrow[{{a_,b_},{c_,d_}}]Arrow[{{b,a},{d,c}}]/.Circle[{a_,b_},c_]Circle[{b,a},c]/.Disk[{a_,b_},c__]Disk[{b,a},c],PlotRange{{-2.5,1.5},{-2,3.5}}]/.{"x""r","r""x"}
Out[]=
We can actually find these fixed points and thus the bifurcation diagram more simply. We need to solve =r+x-ln(1+x)=0.We can only do this numerically though.
x
In[]:=
finsol[r_]:=Select[(x/.NSolve[r+x-Log[1+x]0,x]),Head[#]Real&]//Quietfinsol[-2]
Out[]=
{-0.947531,3.50524}
We can plot these fixed points and this gives us
In[]:=
Reverse[#]&/@Sort[Flatten[Partition[Join[Riffle[#[[2]],#[[1]]],{#[[1]]}],2]&/@DeleteCases[{#,finsol[#]}&/@Range[-1,0,0.0025],{_,{}}|{0.,{0.}}],1]];pl1=Show[ListLinePlot[Select[%,#[[2]]>0&],PlotStyle{Dashed,Blue}],ListLinePlot[Select[%,#[[2]]<0&],PlotStyleBlue],PlotRangeAll,AxesLabelEvaluate[Style[#,16]&/@{"r","x"}]]
Out[]=
The critical point is when the there is only a single solution. This occurs when r=0, x=0:
Critical point at , and this occurs at: :
r=1
x=0
In[]:=
Show[pl1,ListPlot[{{0,0}},PlotStyle{Red,PointSize[0.02]}],AxesLabelEvaluate[Style[#,16]&/@{"r","x"}]]
Out[]=