MICHAELIS_MENTEN
Overview
The MICHAELIS_MENTEN
function numerically solves the Michaelis-Menten system of ordinary differential equations for enzyme kinetics, describing the rate of substrate conversion by an enzyme. The classic Michaelis-Menten equation is:
where is the reaction rate, is enzyme concentration, is substrate concentration, is the turnover number, and is the Michaelis constant. The function integrates the ODE system for substrate and enzyme concentrations over time using SciPy’s ODE solver (scipy.integrate.solve_ivp ). Only the basic two-variable model is exposed; extensions for multiple substrates, inhibitors, or allosteric effects are not supported. The integration method can be selected from several common solvers, but only the most used options are exposed. This example function is provided as-is without any representation of accuracy.
Usage
To use the function in Excel:
=MICHAELIS_MENTEN(s_initial, e_initial, k_cat, k_m, t_start, t_end, [method])
s_initial
(float, required): Initial substrate concentration.e_initial
(float, required): Initial enzyme concentration.k_cat
(float, required): Turnover number.k_m
(float, required): Michaelis constant.t_start
(float, required): Start time for integration.t_end
(float, required): End time for integration.method
(str, optional, default=‘RK45’): Integration method. One ofRK45
,RK23
,DOP853
,Radau
,BDF
,LSODA
.
The function returns a 2D array (table) with columns: t
, S
, E
, representing time, substrate, and enzyme concentrations at each step. If the input is invalid or integration fails, a string error message is returned.
Examples
Example 1: Basic Case (Default Method)
Inputs:
s_initial | e_initial | k_cat | k_m | t_start | t_end | method |
---|---|---|---|---|---|---|
10.0 | 1.0 | 2.0 | 1.0 | 0.0 | 5.0 | RK45 |
Excel formula:
=MICHAELIS_MENTEN(10.0, 1.0, 2.0, 1.0, 0.0, 5.0)
Expected output:
t | S | E |
---|---|---|
0.000 | 10.000 | 1.000 |
0.038 | 9.931 | 1.000 |
0.417 | 9.245 | 1.000 |
2.204 | 6.089 | 1.000 |
3.452 | 4.010 | 1.000 |
4.323 | 2.674 | 1.000 |
5.000 | 1.746 | 1.000 |
Example 2: With Optional Method (RK23)
Inputs:
s_initial | e_initial | k_cat | k_m | t_start | t_end | method |
---|---|---|---|---|---|---|
5.0 | 0.5 | 1.5 | 0.5 | 0.0 | 2.0 | RK23 |
Excel formula:
=MICHAELIS_MENTEN(5.0, 0.5, 1.5, 0.5, 0.0, 2.0, "RK23")
Expected output:
t | S | E |
---|---|---|
0.000 | 5.000 | 0.500 |
0.005 | 4.997 | 0.500 |
0.052 | 4.965 | 0.500 |
0.522 | 4.645 | 0.500 |
1.002 | 4.321 | 0.500 |
1.447 | 4.024 | 0.500 |
1.856 | 3.752 | 0.500 |
2.000 | 3.656 | 0.500 |
Example 3: All Arguments Specified
Inputs:
s_initial | e_initial | k_cat | k_m | t_start | t_end | method |
---|---|---|---|---|---|---|
8.0 | 2.0 | 3.0 | 2.0 | 0.0 | 3.0 | RK45 |
Excel formula:
=MICHAELIS_MENTEN(8.0, 2.0, 3.0, 2.0, 0.0, 3.0, "RK45")
Expected output:
t | S | E |
---|---|---|
0.000 | 8.000 | 2.000 |
0.030 | 7.857 | 2.000 |
0.328 | 6.459 | 2.000 |
0.815 | 4.333 | 2.000 |
1.183 | 2.919 | 2.000 |
1.460 | 2.006 | 2.000 |
1.677 | 1.411 | 2.000 |
1.852 | 1.015 | 2.000 |
2.001 | 0.744 | 2.000 |
2.132 | 0.553 | 2.000 |
2.262 | 0.403 | 2.000 |
2.380 | 0.298 | 2.000 |
2.488 | 0.224 | 2.000 |
2.590 | 0.169 | 2.000 |
2.687 | 0.129 | 2.000 |
2.781 | 0.099 | 2.000 |
2.873 | 0.076 | 2.000 |
2.963 | 0.058 | 2.000 |
3.000 | 0.053 | 2.000 |
Example 4: Short Time Span
Inputs:
s_initial | e_initial | k_cat | k_m | t_start | t_end | method |
---|---|---|---|---|---|---|
2.0 | 0.2 | 1.0 | 0.2 | 0.0 | 0.5 | RK45 |
Excel formula:
=MICHAELIS_MENTEN(2.0, 0.2, 1.0, 0.2, 0.0, 0.5)
Expected output:
t | S | E |
---|---|---|
0.000 | 2.000 | 0.200 |
0.044 | 1.992 | 0.200 |
0.479 | 1.913 | 0.200 |
0.500 | 1.909 | 0.200 |
Python Code
from scipy.integrate import solve_ivp
from typing import List, Union
def michaelis_menten(s_initial: float, e_initial: float, k_cat: float, k_m: float, t_start: float, t_end: float, method: str = 'RK45') -> Union[List[List[float]], str]:
"""
Numerically solves the Michaelis-Menten system of ordinary differential equations for enzyme kinetics.
Args:
s_initial: Initial substrate concentration.
e_initial: Initial enzyme concentration.
k_cat: Turnover number.
k_m: Michaelis constant.
t_start: Start time of integration.
t_end: End time of integration.
method: Integration method ('RK45', 'RK23', 'DOP853', 'Radau', 'BDF', 'LSODA'). Default is 'RK45'.
Returns:
2D list with header row: t, S, E. Each row contains time and concentration values, or an error message (str) if input is invalid.
This example function is provided as-is without any representation of accuracy.
"""
# Validate inputs
try:
s0 = float(s_initial)
e0 = float(e_initial)
kcat = float(k_cat)
km = float(k_m)
t0 = float(t_start)
t1 = float(t_end)
except Exception:
return "Invalid input: all initial values and parameters must be numbers."
if t1 <= t0:
return "Invalid input: t_end must be greater than t_start."
if s0 < 0 or e0 < 0 or kcat < 0 or km < 0:
return "Invalid input: concentrations and rate constants must be non-negative."
allowed_methods = ['RK45', 'RK23', 'DOP853', 'Radau', 'BDF', 'LSODA']
if method not in allowed_methods:
return f"Invalid input: method must be one of {allowed_methods}."
# Michaelis-Menten ODE system: dS/dt = -v, dE/dt = 0
def mm_ode(t, y):
S, E = y
v = (kcat * E * S) / (km + S) if (km + S) != 0 else 0.0
dSdt = -v
dEdt = 0.0
return [dSdt, dEdt]
try:
sol = solve_ivp(
mm_ode,
[t0, t1],
[s0, e0],
method=method,
dense_output=False,
rtol=1e-6,
atol=1e-8
)
except Exception as e:
return f"ODE integration error: {e}"
if not sol.success:
return f"ODE integration failed: {sol.message}"
# Prepare output: header row then data rows
result = [["t", "S", "E"]]
for i in range(len(sol.t)):
t_val = float(sol.t[i])
s_val = float(sol.y[0][i])
e_val = float(sol.y[1][i])
# Disallow nan/inf
if any([
not isinstance(t_val, float) or not isinstance(s_val, float) or not isinstance(e_val, float),
t_val != t_val or s_val != s_val or e_val != e_val,
abs(t_val) == float('inf') or abs(s_val) == float('inf') or abs(e_val) == float('inf')
]):
return "Invalid output: nan or inf detected."
result.append([t_val, s_val, e_val])
return result