Hill Equation--Chapter 5. Section 5.4

 S + E -> E+P

E +  (nu)I == X

BOP and OR, October 3 2007. 
Addiel de Alba. April 2010
NS, March 24, 2011

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

Step 1. Stoichiometric matrix

metabolites={"s","e","p","i","x"};
reactions={"v1","v2","v3"}; 
var={x1,x2,x3,x4,x5};
S=(({{-1, 0, 0}, {0, -1, 1}, {1, 0, 0}, {0, -ν, ν}, {0, 1, -1}}));
MatrixForm[Table[{var[[i]],metabolites[[i]]},{i,5}],TableHeadings->{{},{"Notation", "Compounds"}}]
MatrixForm[S,TableHeadings->{var,reactions}]

Step 2. Left Null space

MatrixForm[NullSpace[Transpose[S]].var]

Step 3. Definition of Parameters

ν=2;
k=1;
K=1;
k2=100;
k2i=k2/K;

Step 4. Fluxes

MatrixForm[Table[{var[[i]],metabolites[[i]]},{i,5}],TableHeadings->{{},{Variables, Compounds}}]
v1=k*x1[t]*x2[t];
v2=k2*x2[t]*(x4[t])^ν;
v3=k2i*x5[t];
v={v1,v2,v3};
dxdt=S.v;

Step 5. Simulation

Simulation 1

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

Step 6. Graphs

Plots

graph1=ParametricPlot[Evaluate[{x1[t],x2[t]}/.solution],{t,0,12},FrameLabel->{"s","e"},PlotRange->{All,{0,1.1}},Epilog->ppAnnotate[{x1,x2},solution,tfinal]]

graph2=ParametricPlot[Evaluate[{x2[t],x5[t]}/.solution],{t,0,1000},FrameLabel->{"e","x"},PlotRange->{{0,1.1`},{-0.05,0.5`}},Epilog->ppAnnotate[{x2,x5},solution,tfinal]]

graph3=ParametricPlot[Evaluate[{x4[t],x5[t]}/.solution],{t,0,1000},PlotStyle->{Hue[0.7`]},FrameLabel->{"i","x"},PlotRange->{{0,1.05},{-0.05,0.5`}},Epilog->ppAnnotate[{x4,x5},solution,tfinal]]

graph4=Plot[Evaluate[{x1[t],x2[t],x3[t],x4[t],x5[t]}/.solution],{t,0,0.3`},AxesLabel->{"Time"," "},Epilog->createLegend[{"s","e","p","i","x"}]]

graph5=Plot[Evaluate[{x1[t],x2[t],x3[t],x4[t],x5[t]}/.solution],{t,0,5},Epilog->createLegend[{"s","e","p","i","x"}],AxesLabel->{"Time"," "}]

Step 7. Export Graphs.

(* Export["Section5.4.A.eps",graph1];
Export["Section5.4.B.eps",graph2];
Export["Section5.4.C.eps",graph3];
Export["Section5.4.D.eps",graph4];
Export["Section5.4.E.eps",graph5]; *)