CHW Example 6.2
(Contains all examples in Table 1)

Loads the chemJac command file, which contains all commands used below

(*  SetDirectory["C:\CHEMmma"]*) (* Put in path to chemJac.m *)  
<<"chemJac.m"

Table 1, (i)

Clear[S,vars,monomials, j,det,core]

Inputting the stoichiometric matrix S

S={{-1,1, 0, 0, 2,-2},{-1,1, -1, 1, 0, 0}, {0, 0, -1, 1, -1, 1},{1, -1, 0, 0, 0,0},{0, 0, 1, -1, 0, 0}} (*stoichiometric matrix*); S//MatrixForm

Making the mass-action flux vector 'monomials' and the list of species concentrations 'vars' automatically from S

monomials = makeMonomial[S]

vars=svars[S]

'S.monomials' is the right hand side of the ODE

S.monomials

The Jacobian of the RHS of the ODE, and its Craciun-Feinberg determinant

j=jac[S.monomials, vars];
j//MatrixForm

det=cfDet[j]

coeffs[det]

Core Determinant of the Jacobian of the RHS of the ODE

core=coreDet[j,S]

coeffs[core]

Table 1, (ii)

Clear[S,vars,monomials, j,det,core]

Inputting the stoichiometric matrix S

S=Transpose[{{-1,-1,0,0,1,0,0},{0,-1,-1,0,0,1,0} ,{0,0,-1,-1,0,0,1},{2,0,0,-1,0,0,0}}] (*stoichiometric matrix*); S=makeReversible[S];S//MatrixForm

Making the mass-action flux vector 'monomials' and the list of species concentrations 'vars' automatically from S

monomials = makeMonomial[S]

vars=svars[S]

'S.monomials' is the right hand side of the ODE

S.monomials

The Jacobian of the RHS of the ODE, and its Craciun-Feinberg determinant

j=jac[S.monomials, vars];
j//MatrixForm

det=cfDet[j]

coeffs[det]

Core Determinant of the Jacobian of the RHS of the ODE

core=coreDet[j,S]

coeffs[core]

Table 1, (iii)

Clear[S,vars,monomials, j,det,core]

Inputting the stoichiometric matrix S

S={{-1,1, 0, 0, 0, 0, 0, 0, 2, -2},{-1,1, -1, 1, 0, 0, 0, 0, 0, 0}, {0, 0, -1, 1, -1, 1, 0, 0, 0, 0},{0, 0, 0, 0, -1, 1, -1, 1, 0, 0},{0, 0, 0, 0, 0, 0, -1, 1, -1, 1},{1, -1, 0, 0, 0, 0, 0, 0, 0, 0},{0, 0, 1, -1, 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 1,-1, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 1, -1, 0, 0}} (*stoichiometric matrix*); S//MatrixForm

Making the mass-action flux vector 'monomials' and the list of species concentrations 'vars' automatically from S

monomials = makeMonomial[S]

vars=svars[S]

'S.monomials' is the right hand side of the ODE

S.monomials

The Jacobian of the RHS of the ODE, and its Craciun-Feinberg determinant

j=jac[S.monomials, vars];
j//MatrixForm

det=cfDet[j];

coeffs[det]

Core Determinant of the Jacobian of the RHS of the ODE

core=coreDet[j,S];

coeffs[core]

Table 1, (iv)

Clear[S,vars,monomials, j,det,core]

Inputting the stoichiometric matrix S

S=Transpose[{{-1, -1, 0,1,0},{0,-1, -1,0,1}, {1, 0, -1,0,0}}] (*stoichiometric matrix*); S=makeReversible[S];S//MatrixForm

Making the mass-action flux vector 'monomials' and the list of species concentrations 'vars' automatically from S

monomials = makeMonomial[S]

vars=svars[S]

'S.monomials' is the right hand side of the ODE

S.monomials

The Jacobian of the RHS of the ODE, and its Craciun-Feinberg determinant

j=jac[S.monomials, vars];
j//MatrixForm

det=cfDet[j]

coeffs[det]

Core Determinant of the Jacobian of the RHS of the ODE

core=coreDet[j,S]

coeffs[core]

Table 1, (v)

Clear[S,vars,monomials, j,det,core]

Inputting the stoichiometric matrix S

S={{-1,1, -1, 1, 0, 0, 0, 0},{-1,1, 0, 0, 1, -1, 0, 0}, {0, 0, -1, 1, -1, 1, -1, 1},{0, 0, 0, 0, -1, 1, 1, -1},{0, 0, 0, 0, 0, 0, -1, 1},{1, -1, 0, 0, 0, 0, 0, 0},{0, 0, 1, -1, 0, 0, 0, 0}} (*stoichiometric matrix*); S//MatrixForm

Making the mass-action flux vector 'monomials' and the list of species concentrations 'vars' automatically from S

monomials = makeMonomial[S]

vars=svars[S]

'S.monomials' is the right hand side of the ODE

S.monomials

The Jacobian of the RHS of the ODE, and its Craciun-Feinberg determinant

j=jac[S.monomials, vars];
j//MatrixForm

det=cfDet[j];

coeffs[det]

Core Determinant of the Jacobian of the RHS of the ODE

core=coreDet[j,S];

coeffs[core]

Table 1, (vi)
(In the following three examples (vi), (vii) and (viii) the flux vector needs to be entered manually, because our software can't make the flux vector when a species occurs on both sides of a reaction.  This is because the stoichiometric matrix does not carry all the information for such reactions.)

Clear[S,vars,monomials, j,det,core]

Inputting the stoichiometric matrix S

S= Transpose[{{1,-1},{-1,1}}](*stoichiometric matrix*); S//MatrixForm

monomials = {k1 a b, k2 a^2}

vars={a,b}

'S.monomials' is the right hand side of the ODE

S.monomials

The Jacobian of the RHS of the ODE, and its Craciun-Feinberg determinant

j=jac[S.monomials, vars];
j//MatrixForm

det=cfDet[j]

coeffs[det]

Core Determinant of the Jacobian of the RHS of the ODE

core=coreDet[j,S]

coeffs[core]

Table 1, (vii)

Clear[S,vars,monomials, j,det,core]

Inputting the stoichiometric matrix S

S= Transpose[{{1,-1},{-1,1}}](*stoichiometric matrix*); S//MatrixForm

monomials = {k1 a^2 b, k2 a^3}

vars={a,b}

'S.monomials' is the right hand side of the ODE

S.monomials

The Jacobian of the RHS of the ODE, and its Craciun-Feinberg determinant

j=jac[S.monomials, vars];
j//MatrixForm

det=cfDet[j]

coeffs[det]

Core Determinant of the Jacobian of the RHS of the ODE

core=coreDet[j,S]

coeffs[core]

Table 1, (viii)

Clear[S,vars,monomials, j,det,core]

Inputting the stoichiometric matrix S

S= Transpose[{{2,-2},{-2,2}}](*stoichiometric matrix*); S//MatrixForm

monomials = {k1 a b^2, k2 a^3}

vars={a,b}

'S.monomials' is the right hand side of the ODE

S.monomials

The Jacobian of the RHS of the ODE, and its Craciun-Feinberg determinant

j=jac[S.monomials, vars];
j//MatrixForm

det=cfDet[j]

coeffs[det]

Core Determinant of the Jacobian of the RHS of the ODE

core=coreDet[j,S]

coeffs[core]