Problem Session 2

One dimensional systems

(* Simple Example *)
flow = x-x^2 + a

Plot[Evaluate[flow/.a-> Table[b,{b,-3,3,1}]],{x,-2,2}]

(* Compute fixed point *)
sol =Solve[flow == 0,x]
(* Compute stability *)
D[flow,x]/.sol

(* Compute bifurcation point *)
{flow == 0, D[flow,x]==0}
Solve[%,{x,a}]

Two dimensional linear systems

(* make a stream plot *)
matrix = {{-2,4},{-2,-1}};
matrix//MatrixForm
flow2 = matrix.{x,y}
StreamPlot[flow2,{x,-1,1},{y,-1,1}]

(* plot a reference trajectory *)
ode = Thread[{x'[t],y'[t]}==matrix.{x[t],y[t]}]
(* generate function that creates a trajectory *)
trajec[x0_,y0_,tmax_]:= NDSolve[Join[ode,{x[0]==x0,y[0]==y0}],{x[t],y[t]},{t,0,tmax}]//Flatten

(* check output *)
trajec[1,-1, 10]

(* make a plot *)
plot = ParametricPlot[Evaluate[{x[t],y[t]}/.trajec[1,-1, 10]],{t,0,10}];

(* add text to the plot *)
Show[plot,Graphics[Text[Style["Spiral",15],{-0.03,0.015}]]]