Math 260 Lab #3 Saddle-node and transcritical bifurcations

Save your work regularly--you never know when Mathematica may crash.  
Email your completed file to tleise@amherst.edu by Monday 4pm.

We want to use Mathematica to plot trajectories and bifurcation diagrams.

For example, we know (dx/dt)=r-(x^2) has a saddle-node bifurcation at the critical value r=0.  
We can plot the bifurcation diagram as shown below.  
(The PlotStyle command says the first curve should be plain black and the second curve should be dashed.)

Plot[{Sqrt[r],-Sqrt[r]},{r,0,4},PlotStyle->{{Black,Thickness[.005]},{Black,Dashing[{0.02,0.02}],Thickness[.005]}},AspectRatio->1]

If it is difficult to solve for fixed point in terms of r, then use ParametricPlot to avoid solving for x.
In this case, r=(x^2).

Show[ParametricPlot[{x^2,x},{x,0,2},PlotStyle->{Black,Thickness[.005]}],ParametricPlot[{x^2,x},{x,-2,0},PlotStyle->{Black,Dashing[{0.02,0.02}],Thickness[.005]}],PlotRange->All]

Exercise 1.  Consider the differential equation (dx/dt)= r-x-(e^(-x)).

(a)  Plot y=r-x and y=(e^(-x)) for several values of r, showing different cases of intersection.

(b)  Show that a saddle-node bifurcation occurs at a critical value (Subscript[r, c]) of r (and state what that critical value is).  To determine the critical value, you can either use graphs or use the FindRoot command to solve the tangency condition.

(c)  Use NDSolve to plot several trajectories for a value of r >(Subscript[r, c]). 
(This is to help you determine the stability of each fixed point, so choose initial values on both sides of each fixed point.)

(d)  Use NDSolve to plot several trajectories for a value of r <(Subscript[r, c]).

(e)  Plot the bifurcation diagram.

Exercise 2.  Consider the differential equation (dx/dt)= -x(r-(e^x)).

(a)  Find the fixed points.

(b)  Show that a transcritical bifurcation occurs at a critical value (Subscript[r, c]) of r (and state what that critical value is).

(c)  Use NDSolve to plot several trajectories for a value of r >(Subscript[r, c]).

(d)  Use NDSolve to plot several trajectories for a value of r <(Subscript[r, c]).

(e)  Plot the bifurcation diagram.