MATLAB: What is the difference between an Algebraic Rule and a repeatedAssignment rule in the SimBiology Toolbox 2.4 (R2008b)

SimBiology

I am trying to build a SimBiology model, and I would like the capacity of a compartment ("Cell") change with the concentration of another variable ("X").
In general, this would be Cell = X*k, where X is a species in the simulation and k is a unit conversion factor. I would like this dependency to exist for all time of the simulation and be continuous. I want to write this in a rule, but I find that there are two options: (1) repeatedAssignment rule where the expression would be Cell = X*k, or (2) Algebraic rule where Cell – X*k = 0.
I would like to know what simulation differences, if any, exist between using a repeatedAssignment rule and an algebraic rule.

Best Answer

Mathematically, the two approaches should be equivalent. But from a
numerical/computational standpoint, it is better to use a repeated assignment
whenever possible, because the two types of rules are implemented differently.
Using a Repeated Assignment means the solver has one less equation to solve
during simulations: the equation has been solved ahead of time when designing the model. Repeated Assignment may also lead to increased accuracy, because the solver may only solve algebraic constraints up to the accuracy specified in the configuration set tolerance, while repeated assignments will be solved exactly.