Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

CompartmentalModeling

Guides

  • Compartmental Modeling

Tech Notes

  • Vertical Transmission Models

Symbols

  • DynamicTransmissionModel
  • ForceOfInfection
  • Incidence
  • NextGenerationMatrix
  • CollectModel
  • CompartmentalModelGraph
  • CompetitiveInhibitorKinetics
  • DefinePropensityFunction
  • DeriveTransitions
  • DynamicTransmissionModel
  • EnzymeReaction
  • EpidemiologyModelData
  • EpidemiologyModel
  • ExpandModel
  • ForceOfInfection
  • HillKinetics
  • Incidence
  • KineticCompartmentalModel
  • KineticReactionNetworkModel
  • MichaelisMentenKinetics
  • NextGenerationMatrix
  • NoncompetitiveInhibitorKinetics
  • NullCompartment
  • ResolveCompartmentalModel
  • StochasticSolve
  • StoichiometryTable
  • StratifyModel
  • Transition
  • UncompetitiveInhibitorKinetics
  • VitalDemographicsModel
  • $C
  • $CompartmentalModelingVersion
  • $EpidemiologyColor
  • $EpidemiologyModelingVersion
  • $R
  • $SystemsBiologyModelingVersion
RobertNachbar`CompartmentalModeling`
StochasticSolve
​
StochasticSolve
[r,sm,is,v,{t,
t
min
,
t
max
}]
finds a numerical solution for the stoichiometric matrix
sm
, rates
r
, and initial state
is
for the state variables
v
with the time variable
t
in the range
t
min
to
t
max
.
​
Details and Options

Examples  
(4)
Basic Examples  
(1)
Define the model and rate constants, and and compute the model's properties:
In[1]:=
model=
βλ[t]
→
ℰ,ℰ
ζ
→
ℐ,ℐ
γ
→
ℛ;​​params={β0.000714,ζ0.196,γ0.143,1000,I010};​​modelData=
KineticCompartmentalModel
[model,t]
Out[1]=
Variables{ℰ,ℐ,ℛ,},ComponentTransitionsℰ
ζ
→
ℐ,ℐ
γ
→
ℛ,
βλ[t]
→
ℰ,StoichiometricMatrix{{-1,1,0,0},{0,-1,1,0},{1,0,0,-1}},Rates{ζℰ[t],γℐ[t],β[t]λ[t]},Equations{
′
ℰ
[t]-ζℰ[t]+β[t]λ[t],
′
ℐ
[t]ζℰ[t]-γℐ[t],
′
ℛ
[t]γℐ[t],
′

[t]-β[t]λ[t]},TimeSymbolt
Define the initial state vector and simulate the system:
In[2]:=
state=Replace[modelData["Variables"],{-I0,ℐI0,_0},{1}];​​
StochasticSolve
[modelData["Rates"]/.λ[t]ℐ[t]/.params,modelData["StoichiometricMatrix"],state/.params,modelData["Variables"],{t,0,150}]
Out[2]=
ℰInterpolatingFunction
Domain: {{0.,75.6}}
Output: scalar
,ℐInterpolatingFunction
Domain: {{0.,92.6}}
Output: scalar
,ℛInterpolatingFunction
Domain: {{0.,92.6}}
Output: scalar
,InterpolatingFunction
Domain: {{0.,66.5}}
Output: scalar

Options  
(2)

Applications  
(1)

SeeAlso
DefinePropensityFunction
RelatedGuides
▪
Compartmental Modeling
""

© 2025 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com