This Workbook sets up, simulates and graphs the  equations that describe a simple reversible bi-linear reaction.  It  corresponds to the Ch 4.3 in SB2.

Notation: 

Kinetic parameters: k1,  km1.
Equilibrium constant: K1
Fluxes:  v1, v1m.

BOP April 7, 2007
AB - Last updated: Mar 26, 2010.
NS, March 23, 2011

SetDirectory[NotebookDirectory[]];
<<"GraphicsDirectives.m"

Step 1: define the equations

dxdt={-v1+vm1,-v1+vm1,v1-vm1};

step 2 : define the parmeter values and rate laws

k1=1;km1=1.;K1=k1/km1;
v1=k1*x1[t]*x2[t];
vm1=km1*x3[t];

step 3:  set up the conditions and simulate

tfinal=2;
solution=NDSolve[{x1'[t]==dxdt[[1]],x2'[t]==dxdt[[2]],x3'[t]==dxdt[[3]],x1[0]==3.0,x2[0]==2.0,x3[0]==0},{x1,x2,x3},{t,0,tfinal}];

step 4:  graph the results

graph1=Plot[Evaluate[{x1[t],x2[t],x3[t]}/.solution],{t,0,tfinal},PlotLabel->"Concentrations vs time",AxesLabel->{"Time"," "},Epilog->createLegend[{"x1","x2","x3"}]]

graph2=Plot[Evaluate[{x1[t] x2[t]-((x3[t])/K1),{0.73` (x1[t]-1.73`)+1.73` (x2[t]-0.73`)-(x3[t]-1.27`)},{x1[t]+x3[t]},{x2[t]+x3[t]}}/.solution],{t,0,tfinal},PlotLabel->"Pools versus time",Epilog->createLegend[{"p1","p1-linear","p2","p3"}],AxesLabel->{"Time"," "}]

graph3=ParametricPlot[Evaluate[{x1[t],x2[t]}/.solution],{t,0,tfinal},PlotLabel->"Phase portrait, x1 vs x2",FrameLabel->{"x1","x2"},Epilog->ppAnnotate[{x1,x2},solution,tfinal]]

graph4=ParametricPlot[Evaluate[{x1[t],x3[t]}/.solution],{t,0,tfinal},PlotLabel->"Phase portrait, x1 vs x3",FrameLabel->{"x1","x3"},Epilog->ppAnnotate[{x1,x3},solution,tfinal]]

graph5=ParametricPlot[Evaluate[{x2[t],x3[t]}/.solution],{t,0,tfinal},PlotLabel->"Phase portrait, x2 vs x3",FrameLabel->{"x2","x3"},Epilog->ppAnnotate[{x2,x3},solution,tfinal]]
graph6=Plot[Evaluate[{x1[t] x2[t]-((x3[t])/K1),{0.73` (x1[t]-1.73`)+1.73` (x2[t]-0.73`)-(x3[t]-1.27`)}}/.solution],{t,0,tfinal},PlotLabel->"Pool versus time",Epilog->createLegend[{"p1","p1-linear"}],AxesLabel->{"Time"," "}]
x1[tfinal]/.solution;
x2[tfinal]/.solution;

Step 5:  Export the graphs

(* Export["Section4.3A.eps",graph1];
Export["Section4.3B.eps",graph2]; *)

Appendix: Pool formation

Clear[K1,k1,km1]
K1=k1/km1

MatrixForm[stoich=(({{-1, 1}, {-1, 1}, {1, -1}}))]
MatrixRank[stoich]
leftnull=MatrixForm[(({{1, 0}, {1, 1}})).NullSpace[Transpose[stoich]]]
MatrixForm[pools=(({{.73, 1.73, -1}, {1, 0, 1}, {0, 1, 1}}))]
TeXForm[MatrixForm[pools=(({{.73, 1.73, -1}, {1, 0, 1}, {0, 1, 1}}))]];
TeXForm[MatrixForm[pools.stoich]];
Null

Solve[{x1*x2-x3/K==0, x1+x3==a, x2+x3==b},{x1,x2,x3},{x2,x3}]