# Building a Model – Algebraic Equations | SimBiology Tutorials for QSP, PBPK, and PK/PD Modeling and Analysis

From the series: SimBiology Tutorials for QSP, PBPK, and PK/PD Modeling and Analysis

Learn how to define algebraic equations with SimBiology^{®} of the Model Builder app.

**Published:
13 Sep 2020**

In this video, we'll talk about how to implement algebraic equations in SimBiology. And to define an algebraic equation, you can use one of the following constructs. Initial assignment defines a mathematical expression that is only evaluated once at the beginning of a simulation. It lets you specify the initial value of a parameter, species, or compartment capacity as a function of other model component values.

Initial assignment is expressed as variable equals expression. For instance, koff equals the decision constant, KD, times kon on in the case of reversible binding. A repeated assignment is used to define a time-dependent quantity using an algebraic equation. It's evaluated at every time step, which is determined by the solver during the simulation process.

For instance, the total concentration of the receptor could be equal to the receptor plus complex in a TMDD model. At the start of a simulation, that is, at simulation time equals 0, SimBiology evaluates the initial assignment, and repeated assignment rules, as a set of simultaneous constraints. SimBiology treats the rules as a unified system of constraints and automatically reorders and evaluates them. The order in which the rules appear in the model has no effect on the simulation results.

The next construct is an algebraic rule. It lets you specify mathematical constraints on one or more parameters, species, or compartments that must hold during a simulation. It takes the form 0 equals expression, and the rule is specified as the expression. For instance, the repeated assignment of both could be written 0 equal total receptor minus receptor minus complex.

Repeated assignment rules are mathematically equivalent to algebraic rules but result in exact solutions, instead of approximated solutions. Therefore, it is recommended that you use repeated assignment rules, instead of algebraic rules, whenever possible. Use algebraic rules only when you cannot analytically solve the equations to get a closed-form solution, or you have multiple equations with multiple unknowns, and it could be inconvenient to solve.

If you use a repeated assignment or an algebraic rule to vary the value of a compartment during the simulation, make sure their constant property is set to false. If the quantity defined by your mathematical expression is not used to compute other quantities in your model, you could also define it as a post-simulation observable. However, we dedicate another video to observables because they can be used in more use cases.

So let's see now how to implement initial and repeated assignments in the model builder app. In this model, the PK is modeled using a two-compartment TMDD model. We expect the receptor to be at steady state when no drug was administered. Which means that we will define the synthesis rate, ksyn, as a function of the receptor concentration at steady state, and its remission rate, kel.

Since ksyn will be defined as the beginning of the simulation and will not change afterwards, we can define this expression as an initial assignment. ksyn equal to kel times receptor. We don't need to use the dot notation to specify receptor, because its name is unique in the entire model. If the expression contained the plasma drug concentration, for example, we would need to use the notation central.drug to differentiate it from the drug concentration in the peripheral compartment.

Note that a new icon appears next to the one representing its constant value. We can now show the initial conditions and see that ksyn has been updated to 0, since initial concentration of receptor is currently set to 0. So let's change it to 10, and change kel to 0.2. And now, the initial value of ksyn shows 2, as expected.

Let's now add a new parameter to compute the receptor occupancy, RO, which is defined as the fraction of the total receptor concentration bound to the drug. RO is dimensionless, so we will define it as a parameter. And since it will depend on receptor and complex, which are time dependent, it will itself be time dependent.

So we need to define it as non-constant. We can now add a repeated assignment and make sure that the initial value of RO is computed correctly in the parameter list. And finally, the repeated assignments will be displayed in the list of equations. This concludes the tutorial. Thanks for watching.

Seleziona un sito web

Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .

Puoi anche selezionare un sito web dal seguente elenco:

Come ottenere le migliori prestazioni del sito

Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.

Americhe

- América Latina (Español)
- Canada (English)
- United States (English)

Europa

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)

Asia-Pacifico

- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)