RobertNachbar/CompartmentalModeling

Build, visualize, analyze, and simulate compartmental models

Contributed By: rnachbar@wolfram.com  |  Robert Nachbar

Compartmental models are a convenient way to describe and analyse processes that involve the movement of items from one place or state to another. The items can be people, money, molecules, ideas, …. The compartmental model itself is just a representation of the information or data, and can be converted into other mathematical representations, such as differential equations, for analysis. Compartmental models are used frequently in the fields of chemical reactions, systems biology, ecology, epidemiology, pharmacokinetics, and many more.

Installation Instructions

To install this paclet in your Wolfram Language environment, evaluate this code:
PacletInstall[ResourceObject["RobertNachbar/CompartmentalModeling"]]

Details

The CompartmentalModeling paclet is intended to support compartment models in general.
The Transition is the fundemental object from which compartmental models are built in Wolfram Language; it describes the movement of items from one place to another or the change of state of one item to another.
Domain-specific functionality is provided for dynamic transmission models in epidemiology and for systems biology models (including chemical reaction kinetics); support for pharmacokinetics is planned.
Version 12.1 or newer of the Wolfram Language is required.

Paclet Guide

Examples

Basic Examples (3) 

Write a transition for the infection of a susceptible individual for an SIR epidemiology model:

In[1]:=
InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["Transition", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"RobertNachbar/CompartmentalModeling\"", ",", "\"RobertNachbar`CompartmentalModeling`Transition\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["RobertNachbar/CompartmentalModeling", "RobertNachbar`CompartmentalModeling`Transition"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["RobertNachbar/CompartmentalModeling", "RobertNachbar`CompartmentalModeling`Transition"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][\[ScriptCapitalS], \[Beta] \[Lambda][t], \[ScriptCapitalI]]
Out[1]=

Write a transition for a reaction for a reaction network model:

In[2]:=
InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["Transition", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"RobertNachbar/CompartmentalModeling\"", ",", "\"RobertNachbar`CompartmentalModeling`Transition\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["RobertNachbar/CompartmentalModeling", "RobertNachbar`CompartmentalModeling`Transition"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["RobertNachbar/CompartmentalModeling", "RobertNachbar`CompartmentalModeling`Transition"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][2 A + B, k, X]
Out[2]=

Write a transition for the absorption of a drug from the gut into the blood stream for a pharmacokinetics model:

In[3]:=
InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["Transition", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"RobertNachbar/CompartmentalModeling\"", ",", "\"RobertNachbar`CompartmentalModeling`Transition\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["RobertNachbar/CompartmentalModeling", "RobertNachbar`CompartmentalModeling`Transition"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["RobertNachbar/CompartmentalModeling", "RobertNachbar`CompartmentalModeling`Transition"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][Subscript[\[ScriptCapitalD], gut], Subscript[k, abs], Subscript[\[ScriptCapitalD], blood]]
Out[3]=

Generate the reactions for an enzyme catalyzed reaction:

In[4]:=
InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["EnzymeReaction", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"RobertNachbar/CompartmentalModeling\"", ",", "\"RobertNachbar`SystemsBiologyModeling`EnzymeReaction\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["RobertNachbar/CompartmentalModeling", "RobertNachbar`SystemsBiologyModeling`EnzymeReaction"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["RobertNachbar/CompartmentalModeling", "RobertNachbar`SystemsBiologyModeling`EnzymeReaction"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][\[ScriptCapitalS], {Subscript[ks, a], Subscript[ks, d]}, \[ScriptCapitalE], Subscript[kp, d], \[ScriptCapitalP]]
Out[4]=

Draw the compartmental model graph of a simple reaction network:

In[5]:=
InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["CompartmentalModelGraph", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"RobertNachbar/CompartmentalModeling\"", ",", "\"RobertNachbar`CompartmentalModeling`CompartmentalModelGraph\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["RobertNachbar/CompartmentalModeling", "RobertNachbar`CompartmentalModeling`CompartmentalModelGraph"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["RobertNachbar/CompartmentalModeling", "RobertNachbar`CompartmentalModeling`CompartmentalModelGraph"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][{2 A + B 
\!\(\*OverscriptBox[\(\[RightArrow]\), 
SubscriptBox[\(k\), \(1\)]]\) X, X 
\!\(\*OverscriptBox[\(\[RightArrow]\), 
SubscriptBox[\(k\), \(2\)]]\) 2 Y}, GraphTheme -> "PetriNet", Sequence[
 GraphLayout -> {"LayeredEmbedding", "Orientation" -> Left, "RootVertex" -> A}]]
Out[5]=

Draw the compartmental model graph of an SEIR epidemiology model:

In[6]:=
InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["CompartmentalModelGraph", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"RobertNachbar/CompartmentalModeling\"", ",", "\"RobertNachbar`CompartmentalModeling`CompartmentalModelGraph\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["RobertNachbar/CompartmentalModeling", "RobertNachbar`CompartmentalModeling`CompartmentalModelGraph"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["RobertNachbar/CompartmentalModeling", "RobertNachbar`CompartmentalModeling`CompartmentalModelGraph"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][{\[ScriptCapitalS] 
\!\(\*OverscriptBox[\(\[RightArrow]\), \(\[Beta]\ \[Lambda][
      t]\)]\) \[ScriptCapitalE], \[ScriptCapitalE] 
\!\(\*OverscriptBox[\(\[RightArrow]\), \(\[Zeta]\)]\) \[ScriptCapitalI], \[ScriptCapitalI] 
\!\(\*OverscriptBox[\(\[RightArrow]\), \(\[Gamma]\)]\) \[ScriptCapitalR]}, Sequence[
 "CompartmentColors" -> {\[ScriptCapitalS] -> RGBColor[
     0.10980392156862745`, 0.6745098039215687, 0.47058823529411764`], \[ScriptCapitalE] -> RGBColor[
     1., 0.8117647058823529, 0.2823529411764706], \[ScriptCapitalI] -> RGBColor[
     0.9882352941176471, 0.1568627450980392, 0.2784313725490196], \[ScriptCapitalR] -> RGBColor[
     0.12156862745098039`, 0.4588235294117647, 0.996078431372549]}]]
Out[6]=

Draw the compartmental model graph of a pharmacokinetics model:

In[7]:=
InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["CompartmentalModelGraph", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"RobertNachbar/CompartmentalModeling\"", ",", "\"RobertNachbar`CompartmentalModeling`CompartmentalModelGraph\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["RobertNachbar/CompartmentalModeling", "RobertNachbar`CompartmentalModeling`CompartmentalModelGraph"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["RobertNachbar/CompartmentalModeling", "RobertNachbar`CompartmentalModeling`CompartmentalModelGraph"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][{Subscript[\[ScriptCapitalD],
    gut] 
\!\(\*OverscriptBox[\(\[RightArrow]\), 
SubscriptBox[\(k\), \(abs\)]]\) Subscript[\[ScriptCapitalD], blood], Subscript[\[ScriptCapitalD], blood] 
\!\(\*UnderoverscriptBox[\(\[Equilibrium]\), 
SubscriptBox[\(k\), \(out\)], 
SubscriptBox[\(k\), \(in\)]]\) Subscript[\[ScriptCapitalD], fat], Subscript[\[ScriptCapitalD], blood] 
\!\(\*OverscriptBox[\(\[RightArrow]\), 
SubscriptBox[\(k\), \(met\)]]\) Subscript[\[ScriptCapitalM], blood], Subscript[\[ScriptCapitalD], blood] 
\!\(\*OverscriptBox[\(\[RightArrowBar]\), 
SubscriptBox[\(k\), \(elim, \[ScriptCapitalD]\)]]\), Subscript[\[ScriptCapitalM], blood] 
\!\(\*OverscriptBox[\(\[RightArrowBar]\), 
SubscriptBox[\(k\), \(elim, \[ScriptCapitalM]\)]]\)}, Sequence[
 GraphLayout -> {"LayeredEmbedding", "RootVertex" -> Subscript[\[ScriptCapitalD], gut], "Orientation" -> Left}]]
Out[7]=

Generate the Michaelis-Menten kinetic law for an enzyme catalyzed reaction with a competitive inhibitor:

In[8]:=
InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["CompetitiveInhibitorKinetics", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"RobertNachbar/CompartmentalModeling\"", ",", "\"RobertNachbar`SystemsBiologyModeling`CompetitiveInhibitorKinetics\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["RobertNachbar/CompartmentalModeling", "RobertNachbar`SystemsBiologyModeling`CompetitiveInhibitorKinetics"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["RobertNachbar/CompartmentalModeling", "RobertNachbar`SystemsBiologyModeling`CompetitiveInhibitorKinetics"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][{\[ScriptCapitalS], Subscript[k, s]}, {\[ScriptCapitalI], Subscript[k, i]}, Subscript[v, max], t]
Out[8]=

Scope (2) 

Add transitions to an SEIR epidemiology model for vital demographics:

In[9]:=
model = InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["VitalDemographicsModel", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"RobertNachbar/CompartmentalModeling\"", ",", "\"RobertNachbar`EpidemiologyModeling`VitalDemographicsModel\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["RobertNachbar/CompartmentalModeling", "RobertNachbar`EpidemiologyModeling`VitalDemographicsModel"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["RobertNachbar/CompartmentalModeling", "RobertNachbar`EpidemiologyModeling`VitalDemographicsModel"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][{\[ScriptCapitalS] 
\!\(\*OverscriptBox[\(\[RightArrow]\), \(\[Beta]\ \[Lambda][
       t]\)]\) \[ScriptCapitalE], \[ScriptCapitalE] 
\!\(\*OverscriptBox[\(\[RightArrow]\), \(\[Zeta]\)]\) \[ScriptCapitalI], \[ScriptCapitalI] 
\!\(\*OverscriptBox[\(\[RightArrow]\), \(\[Gamma]\)]\) \[ScriptCapitalR]}, \[ScriptCapitalS] -> \[CapitalLambda]]
Out[9]=
In[10]:=
InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["CompartmentalModelGraph", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"RobertNachbar/CompartmentalModeling\"", ",", "\"RobertNachbar`CompartmentalModeling`CompartmentalModelGraph\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["RobertNachbar/CompartmentalModeling", "RobertNachbar`CompartmentalModeling`CompartmentalModelGraph"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["RobertNachbar/CompartmentalModeling", "RobertNachbar`CompartmentalModeling`CompartmentalModelGraph"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][model, Sequence[
 GraphLayout -> {"LayeredEmbedding", "Orientation" -> Left, "RootVertex" -> \[ScriptCapitalS]}, "CompartmentColors" -> {\[ScriptCapitalS] -> RGBColor[
     0.10980392156862745`, 0.6745098039215687, 0.47058823529411764`], \[ScriptCapitalE] -> RGBColor[
     1., 0.8117647058823529, 0.2823529411764706], \[ScriptCapitalI] -> RGBColor[
     0.9882352941176471, 0.1568627450980392, 0.2784313725490196], \[ScriptCapitalR] -> RGBColor[
     0.12156862745098039`, 0.4588235294117647, 0.996078431372549]}]]
Out[10]=

Compute the ODEs, stoichiometric matrix, reaction rates, and other model data for a reaction network model:

In[11]:=
InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["KineticReactionNetworkModel", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"RobertNachbar/CompartmentalModeling\"", ",", "\"RobertNachbar`SystemsBiologyModeling`KineticReactionNetworkModel\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["RobertNachbar/CompartmentalModeling", "RobertNachbar`SystemsBiologyModeling`KineticReactionNetworkModel"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["RobertNachbar/CompartmentalModeling", "RobertNachbar`SystemsBiologyModeling`KineticReactionNetworkModel"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][{2 A + B 
\!\(\*OverscriptBox[\(\[RightArrow]\), 
SubscriptBox[\(k\), \(1\)]]\) X, X 
\!\(\*OverscriptBox[\(\[RightArrow]\), 
SubscriptBox[\(k\), \(2\)]]\) 2 Y}, t]
Out[11]=

Compute the ODEs, force of infection, and other model data for an age-stratified SEIR epidemiology model:

In[12]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/63653509-e650-44b3-9682-f1fa04c943c6"]
Out[13]=
In[14]:=
Column@modelData["Equations"]
Out[14]=
In[15]:=
modelData["ForceOfInfection"]
Out[15]=

License Information

MIT License

Resource History

Paclet Source

Source Metadata