Load a model into a symengine environment
Usage
rxS(
x,
doConst = TRUE,
promoteLinSens = FALSE,
envir = parent.frame(),
pkTime = FALSE,
timeSwitch = FALSE
)Arguments
- x
rxode2 object
- doConst
Load constants into the environment as well; a character vector loads every constant except the named ones.
- promoteLinSens
Promote solved linear compartment systems to sensitivity-based solutions.
- envir
default is
NULL; Environment to put symengine variables in.- pkTime
When
TRUE,timein statements that do not depend on a state is loaded asrx_time_pk, defined byrx_time_pk~tin..lhs0, so it stays separate from thetimeind/dt()after those statements are inlined;rxSolve(..., nonmem = TRUE)then reads it as the record time. Only for callers that write..lhs0into the model they build.- timeSwitch
When
TRUE, a comparison of time with an expression of the parameters (t >= exp(ltsw)) is loaded as a comparison with an internal variablerx_tsw_<k>_holding that expression, so a sensitivity model can declare itmtime()and add the exact jump at the switch (see.rxTimeSwitchLines())."check"only records such comparisons. Only for callers that write those declarations into the model they build.
See also
Other Symbolic tools:
rxSymEngineCacheReset(),
rxToSE()
Examples
# \donttest{
pk <- function() {
model({
d/dt(depot) <- -ka * depot
d/dt(central) <- ka * depot - cl / v * central
})
}
s <- rxS(pk)
#>
#>
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
# the d/dt() lines as loaded
s$..ddt
#> [1] "d/dt(depot)=-ka*depot" "d/dt(central)=ka*depot-cl*central/v"
# each derivative is a symengine expression; differentiate it in the env
with(s, D(rx__d_dt_central__, ka))
#> (Symbol) depot
# }
