Why removing N variable in equationsToTransitions?
SergeStinckwich opened this issue · 4 comments
SergeStinckwich commented
Why do we need to remove N from the events in equationsToTransitions method:
equationsToTransitions
"This is only working for status ODE equations, not general ODE equations"
| events |
events := self generateEvents.
"Remove N variable in events rate. Why?"
events do: [ :e |
e fromStatus = #empty ifTrue: [
e rate: (e rate removeVariable: (KEVariable new symbol: #N)) ] ].
events do: [ :each |
self
addTransitionFrom: { (#status -> each fromStatus) }
to: { (#status -> each toStatus) }
probability: each rate ].
"Why initializing equations at the end?"
equations := OrderedCollection new
btmanh commented
Because in the equation of S, dS/dt = muN - lambdaS, we have the transition: empty — mu —> S
however the rate extract from the equation is muN, and we store only per capita transition rate, so to obtain the rate mu, we remove N.
SergeStinckwich commented
Maybe a correct way to do it, is to store only per capita transition rate when we generate the events (in method generateEvents
), so don't have to deal with that later.
btmanh commented
Yes, i agree. And it seems that in the generateEvents method, we store per capita rate for other events, except empty-->S.
SergeStinckwich commented
Why there is a special treatment for empty -> S ?