Fig 3.03#
Michaelis-Menten kinetics
using OrdinaryDiffEq
using ModelingToolkit
using Catalyst
using Plots
Plots.default(linewidth=2)
Reaction network
rn = @reaction_network begin
(k1, km1), S + E <--> ES
k2, ES --> E + P
end
\[\begin{split} \begin{align*}
\mathrm{S} + \mathrm{E} &\xrightleftharpoons[\mathtt{km1}]{\mathtt{k1}} \mathrm{\mathtt{ES}} \\
\mathrm{\mathtt{ES}} &\xrightarrow{\mathtt{k2}} \mathrm{E} + \mathrm{P}
\end{align*}
\end{split}\]
setdefaults!(rn, [
:S=>5.,
:ES=>0.,
:E=>1.,
:P=>0.,
:k1 => 30.,
:km1 => 1.,
:k2 => 10.,
])
osys = convert(ODESystem, rn; remove_conserved = true) |> structural_simplify
\[\begin{split} \begin{align}
\frac{\mathrm{d} E\left( t \right)}{\mathrm{d}t} &= \mathtt{k2} \left( - E\left( t \right) + \Gamma_{1} \right) + \mathtt{km1} \left( - E\left( t \right) + \Gamma_{1} \right) - \mathtt{k1} E\left( t \right) S\left( t \right) \\
\frac{\mathrm{d} S\left( t \right)}{\mathrm{d}t} &= \mathtt{km1} \left( - E\left( t \right) + \Gamma_{1} \right) - \mathtt{k1} E\left( t \right) S\left( t \right)
\end{align}
\end{split}\]
observed(osys)
\[\begin{split} \begin{align}
\mathtt{ES}\left( t \right) &= - E\left( t \right) + \Gamma_{1} \\
P\left( t \right) &= E\left( t \right) - S\left( t \right) + \Gamma_{2}
\end{align}
\end{split}\]
tend = 1.0
1.0
prob = ODEProblem(osys, [], tend)
sol = solve(prob)
retcode: Success
Interpolation: 3rd order Hermite
t: 37-element Vector{Float64}:
0.0
0.006600703726699514
0.01022277056012863
0.015543467478140675
0.02051947168533509
0.02641018786018821
0.03261917715421904
0.03974230175678756
0.04773168899544981
0.0570841908779507
⋮
0.6470324023587559
0.6931031408477125
0.7367683827322631
0.7791059865493958
0.8212466198548
0.8642333668324144
0.9090993660547448
0.9568878660418696
1.0
u: 37-element Vector{Vector{Float64}}:
[1.0, 5.0]
[0.41804761979593485, 4.395302952712936]
[0.2827770333522637, 4.236279331946385]
[0.17911174466168822, 4.091342551218703]
[0.1328519100257544, 4.002950476488606]
[0.10715692365888245, 3.925313806244003]
[0.09568932433965074, 3.85800052655833]
[0.0909210995469164, 3.7886141048233877]
[0.08982060235163537, 3.714822139187139]
[0.09058864991025088, 3.630491809608812]
⋮
[0.7252277328768336, 0.0484033853433716]
[0.8069728851541077, 0.023100689055415024]
[0.8663842812196444, 0.011833488316888192]
[0.9083028367930728, 0.006550597043570977]
[0.9376852665106248, 0.0038559086789705216]
[0.9582641290934263, 0.00235582556741738]
[0.9726435047202581, 0.0014581179992702075]
[0.9825982936657857, 0.0008953036977517671]
[0.9884434120994314, 0.0005834282632164051]
@unpack S, ES, E, P = osys
plot(sol, idxs=[S, ES, E, P], xlabel="Time (AU)", ylabel="Concentration (AU)", legend=:right, title="Fig 3.03")

rn303mm = @reaction_network begin
mm(S, k2 * ET, (km1 + k2) / k1), S ⇒ P ## using \Rightarrow
end
\[ \begin{align*}
\mathrm{S} &\xrightarrow{\frac{\mathtt{ET} S \mathtt{k2}}{S + \frac{\mathtt{k2} + \mathtt{km1}}{\mathtt{k1}}}} \mathrm{P}
\end{align*}
\]
setdefaults!(rn303mm, [
:S=>5.,
:ET=>1.,
:P=>0.,
:k1 => 30.,
:km1 => 1.,
:k2 => 10.,
])
osysmm = convert(ODESystem, rn303mm; remove_conserved = true) |> structural_simplify
\[ \begin{align}
\frac{\mathrm{d} S\left( t \right)}{\mathrm{d}t} &= \frac{ - \mathtt{ET} \mathtt{k2} S\left( t \right)}{\frac{\mathtt{k2} + \mathtt{km1}}{\mathtt{k1}} + S\left( t \right)}
\end{align}
\]
tend = 1.0
probmm = ODEProblem(osysmm, [], tend)
solmm = solve(probmm)
retcode: Success
Interpolation: 3rd order Hermite
t: 15-element Vector{Float64}:
0.0
0.08829951015219592
0.2967725537625472
0.5000004875811703
0.6196473972837556
0.6670104453577671
0.7099275100893456
0.7465737578395125
0.7827003202641042
0.8170029171212273
0.8515324938674043
0.8866728375768105
0.9240249128338719
0.9646817216791721
1.0
u: 15-element Vector{Vector{Float64}}:
[5.0]
[4.182468228248958]
[2.3146741114200724]
[0.7140966653045732]
[0.13296502509374303]
[0.0463025074968492]
[0.01563176034250269]
[0.005910624536905648]
[0.002229911708642734]
[0.0008784935038915187]
[0.0003432013977878646]
[0.00013175527102757403]
[4.7615955140348484e-5]
[1.5733007241347164e-5]
[6.007498446700923e-6]
@unpack S, P = osys
fig = plot(sol, idxs=[S, P], line=(:dash), label=["S (full)" "P (full)"])
plot!(fig, solmm, idxs=[S, P], label=["S (MM)" "P (MM)"])
plot!(fig, title="Fig. 3.03",
xlabel="Time (AU)", ylabel="Concentration (AU)",
xlims=(0., tend), ylims=(0., 5.), legend=:right
)

This notebook was generated using Literate.jl.