Skip to contents

Load a model into a symengine environment

Usage

rxS(
  x,
  doConst = TRUE,
  promoteLinSens = FALSE,
  envir = parent.frame(),
  pkTime = FALSE
)

Arguments

x

rxode2 object

doConst

Load constants into the environment as well.

promoteLinSens

Promote solved linear compartment systems to sensitivity-based solutions.

envir

default is NULL; Environment to put symengine variables in.

pkTime

When TRUE, time in statements that do not depend on a state is loaded as rx_time_pk, defined by rx_time_pk~t in ..lhs0, so it stays separate from the time in d/dt() after those statements are inlined; rxSolve(..., nonmem = TRUE) then reads it as the record time. Only for callers that write ..lhs0 into the model they build.

Value

rxode2/symengine environment

See also

Other Symbolic tools: rxSymEngineCacheReset(), rxToSE()

Author

Matthew Fidler

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
# }