This Workbook sets up, simulates and graphs the  equations that describe a coupled set of simple reversible reactions.  It  corresponds to the Ch 4.5 of SB2.

Notation: 

 Kinetic parameters: k1, km1, k2, km2.
Equilibrium constants: K1, K2.
 Fluxes:  v1, v1m, v2, v2m.


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

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

Step 1: define the equations

stoich=(({{-1, 1, 0, 0}, {-1, 1, 0, 0}, {1, -1, -1, 1}, {0, 0, 1, -1}, {0, 0, 1, -1}}));
v={v1,vm1,v2,vm2};
dxdt=stoich.v;

step 2 : define the parmeter values and rate laws

k1=1;km1=1;k2=1;km2=1;K1=k1/km1;K2=k2/km2;
v1=k1*x1[t]*x2[t];
vm1=km1*x3[t];
v2=k2*x3[t];
vm2=km2*x4[t]*x5[t];

step 3:  set up the conditions and simulate

tfinal=5;
solution=NDSolve[{x1'[t]==dxdt[[1]],x2'[t]==dxdt[[2]],x3'[t]==dxdt[[3]],x4'[t]==dxdt[[4]],x5'[t]==dxdt[[5]],x1[0]==3.0,x2[0]==3.0,x3[0]==0,x4[0]==0.0,x5[0]==0},{x1,x2,x3,x4,x5},{t,0,tfinal}];

step 4:  graph the results

graph1=Plot[Evaluate[{x1[t],x2[t],x3[t],x4[t],x5[t]}/.solution],{t,0,tfinal},PlotLabel->"Concentrations vs time",Epilog->createLegend[{"x1","x2","x3","x4","x5"}],AxesLabel->{"Time"," "}]
graph2=Plot[Evaluate[{x1[t] x2[t]-((x3[t])/K1),x3[t]-((x4[t] x5[t])/K2),x1[t]+x3[t]+x5[t],x2[t]+x3[t]+x4[t],x2[t]+x3[t]+x5[t]}/.solution],{t,0,tfinal},PlotLabel->"Pools versus time",AxesLabel->{"Time"," "},Epilog->createLegend[{"P1","P2","P3","P4","P5"}]]

step 5: Export the graphs

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

Appendix: Pool formation

Clear[K1, K2,k1,km1,k2,km2]
MatrixForm[stoich=(({{-1, 0}, {-1, 0}, {1, -1}, {0, 1}, {0, 1}}))]
MatrixForm[v=(({{k1.p1}, {k2.p2}}))]
MatrixRank[stoich]
leftnull=MatrixForm[(({{1, 0, 0}, {0, 1, 1}, {1, 0, 1}})).NullSpace[Transpose[stoich]]]

MatrixForm[pools=(({{x2, x1, -1/K1, 0, 0}, {0, 0, 1, -x5/K2, -x4/K2}, {1, 0, 1, 0, 1}, {0, 1, 1, 1, 0}, {0, 1, 1, 0, 1}}))]
MatrixForm[pools.stoich]
MatrixForm[pools.stoich.v]
TeXForm[MatrixForm[pools.stoich.v]];