The Lambert function

Written by

in

The Lambert function is a less known function which has a lot nice applications in sciences.

The Lambert function WW is defined as follow:

z=w⋅exp⁡(w)⇔w=W(z)z = w\cdot\exp(w) \Leftrightarrow w= W(z)

It is a multi-valued function with two real branches W0W_0 and W−1W_{-1}. The figure below shows the real valued function and its inverses functions (real branches).

Michaelis-Menten

It can be shown that the Michaelis-Menten equation can lead to an analytical solution using the Lambert function. Given the Michaelis-Menten equation:

dSdt=−vmax⁡⋅SKM+S\frac{\mathrm{d}S}{\mathrm{d}t} = -\frac{v_{\max} \cdot S}{K_M + S}

It is a separable ordinary differential equation, we can solve it explicitly for tt:

∫S0S(KMvmax⁡S+1vmax⁡)dS=−∫0tdt\int\limits_{S_0}^{S}\left(\frac{K_M}{v_{\max}S} + \frac{1}{v_{\max}}\right)\mathrm{d}S = -\int\limits_{0}^{t}\mathrm{d}t

It goes as follow:

−t=Kvmax⁡ln⁡|SS0|+1vmax⁡(S−S0)-t = \frac{K}{v_{\max}}\ln\left|\frac{S}{S_0}\right| + \frac{1}{v_{\max}}(S-S_0)

This is where the Lambert function comes into play, it allows us to isolate S(t)S(t). First we rewrite the equation such as:

SKMexp⁡(SKM)=S0KMexp⁡(−vmax⁡t+S0KM)\frac{S}{K_M}\exp\left(\frac{S}{K_M}\right) = \frac{S_0}{K_M}\exp\left(\frac{-v_{\max}t + S_0}{K_M}\right)

Then we simply apply the definition of the Lambert function:

S(t)=KMW[S0KMexp⁡(−vmax⁡t+S0KM)]S(t) = K_MW\left[\frac{S_0}{K_M}\exp\left(\frac{-v_{\max}t + S_0}{K_M}\right)\right]

Which is the analytical solution of the Michaelis-Menten equation.

Numerical solution

The Michaelis-Menten ODE can be solved numerically using Python and scipy for a given set of parameters and initial condition:

import numpy as np
from scipy import special, integrate, optimize
import matplotlib.pyplot as plt

K_M = 1e-3
v_max = 1e-4

def system(t, S, K_M, v_max):
    return np.array([
        - v_max * S[0] / (K_M + S[0])
    ])

t = np.linspace(0, 300, 200)
S0 = 1e-2

solution = integrate.solve_ivp(system, [t[0], t[-1]], [S0], t_eval=t, args=(K_M, v_max))
S = solution.y[0,:]

Now we can recover this parameters and initial condition by fitting the ODE solution using the analytical function found above:

def model(t, K_M, v_max, S_0):
    return np.real(K_M * special.lambertw((S_0 / K_M) * np.exp((- v_max * t + S_0) / K_M), 0))

popt, pcov = optimize.curve_fit(model, t, S)
Shat = model(t, *popt)

We can show that both model numerically agree:

Analytical solution

The Michaelis-Menten ODE can be solved analytically using Python and sympy package:

import sympy as sp

K = sp.Symbol("K", real=True, positive=True)
v = sp.Symbol("v", real=True, positive=True)
S0 = sp.Symbol("S0", real=True, positive=True)
t = sp.Symbol("t", real=True)
S = sp.Function("S")

equation = sp.Eq(sp.Derivative(S(t), t), - v * S(t) / (K + S(t)))

sp.dsolve(equation, ics={S(0): S0})

Which returns the above found function:

S(t)=KW(eKlog⁡(S0)+S0−tvKK)\displaystyle S{\left(t \right)} = K W\left(\frac{e^{\frac{K \log{\left(S_{0} \right)} + S_{0} – t v}{K}}}{K}\right)

It can also be confirmed using Wolfram Alpha.