I found some edge cases for template_model_from_sympy_odes.
Case 1
Fixed Birth (l) and proportionate death (m X) processes are interpreted correctly as natural production and natural degradation:
\frac{d S}{d t} = -b S I + l - m S
\frac{d I}{d t} = b S I - g I - m I
\frac{d R}{d t} = g I - m R
However, I had expected the m S terms on d I/d t, d R/d t to be interpreted controlled degradation templates with rate laws m * S.
\frac{d S}{d t} = -b S I + l - m S
\frac{d I}{d t} = b S I - g I - m S
\frac{d R}{d t} = g I - m S
Doing it directly with template_model_from_sympy_odes gives a model that completely ignores all the m S terms:
odes = [
sympy.Eq(S(t).diff(t), - b * S(t) * I(t) + l - m * S(t)),
sympy.Eq(I(t).diff(t), b * S(t) * I(t) - g * I(t) - m * S(t)),
sympy.Eq(R(t).diff(t), g * I(t) - m * S(t)),
]
Doing it within Terarium (which styles the above LaTeX and converts it to SymPy before sending to MIRA) gives a strange model wherein the rate laws are "-I*S*b + l", "I*S*b - I*g", "I*g" (possibly unrelated to MIRA):
Case 2
This is a case with "branching ratios":
\frac{d S}{d t} = -b S I
\frac{d I}{d t} = b S I - g I
\frac{d R}{d t} = k g I
\frac{d V}{d t} = (1 - k) g I
This gives a model where I has a natural degradation g I and two controlled productions of R, V, instead of two natural conversions from I into R, V.

If we were to rewrite the 2nd equation as \frac{d I}{d t} = b S I - k g I - (1 - k) g I, then MIRA returns the correct model (where I branches into R, V with ratio k).

Such a branching case was actually involved in a paper from which the UCSD team wanted to extract a model and it required careful reading of the text to realize a rewrite of the equations.
Do you have a forthcoming solution to this problem or do you expect users/Terarium to rewrite the equations?
I found some edge cases for
template_model_from_sympy_odes.Case 1
Fixed Birth (
l) and proportionate death (m X) processes are interpreted correctly as natural production and natural degradation:However, I had expected the
m Sterms ond I/d t, d R/d tto be interpreted controlled degradation templates with rate lawsm * S.Doing it directly with
template_model_from_sympy_odesgives a model that completely ignores all them Sterms:Doing it within Terarium (which styles the above LaTeX and converts it to SymPy before sending to MIRA) gives a strange model wherein the rate laws are
"-I*S*b + l", "I*S*b - I*g", "I*g"(possibly unrelated to MIRA):Case 2
This is a case with "branching ratios":
This gives a model where

Ihas a natural degradationg Iand two controlled productions ofR, V, instead of two natural conversions fromIintoR, V.If we were to rewrite the 2nd equation as

\frac{d I}{d t} = b S I - k g I - (1 - k) g I, then MIRA returns the correct model (whereIbranches intoR, Vwith ratiok).Such a branching case was actually involved in a paper from which the UCSD team wanted to extract a model and it required careful reading of the text to realize a rewrite of the equations.
Ibranches intoZ, Rwith ratioetaDo you have a forthcoming solution to this problem or do you expect users/Terarium to rewrite the equations?