diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2020-05-11 15:00:25 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2020-05-11 15:20:53 +0200 |
commit | 6308e7d7898d4f064d321d97d162c6752c22b362 (patch) | |
tree | 5308c9a024fc4df0d0e9486f787228b8c9de535b /R/create_deg_func.R | |
parent | b36ae3d710858ee3ff2907eb2d780e0dff48a4f3 (diff) |
Add analytical solution for DFOP-SFO
This is about twice as fast as deSolve compiled in the case of FOCUS D
Diffstat (limited to 'R/create_deg_func.R')
-rw-r--r-- | R/create_deg_func.R | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/R/create_deg_func.R b/R/create_deg_func.R index 11559799..b29a11f7 100644 --- a/R/create_deg_func.R +++ b/R/create_deg_func.R @@ -16,7 +16,14 @@ #' benchmark( #' analytical = mkinfit(SFO_SFO, FOCUS_D, solution_type = "analytical", quiet = TRUE), #' deSolve = mkinfit(SFO_SFO, FOCUS_D, solution_type = "deSolve", quiet = TRUE), -#' replications = 1) +#' replications = 2) +#' DFOP_SFO <- mkinmod( +#' parent = mkinsub("DFOP", "m1"), +#' m1 = mkinsub("SFO")) +#' benchmark( +#' analytical = mkinfit(DFOP_SFO, FOCUS_D, solution_type = "analytical", quiet = TRUE), +#' deSolve = mkinfit(DFOP_SFO, FOCUS_D, solution_type = "deSolve", quiet = TRUE), +#' replications = 2) #' } create_deg_func <- function(spec, use_of_ff = c("min", "max")) { @@ -94,6 +101,21 @@ create_deg_func <- function(spec, use_of_ff = c("min", "max")) { "(((", k2, "-", k12, "-", k10, ")*", n20, "-", k12, "*", n10, ")*exp(-", k2, "*t)+", k12, "*", n10, "*exp(-(", k_parent, ")*t))/(", k2, "-(", k_parent, "))") } + + # dfop_f12_sfo + if (all(use_of_ff == "max", spec[[1]]$sink == TRUE, length(obs_vars) == 2, + spec[[1]]$type == "DFOP", spec[[2]]$type == "SFO")) { + supported <- TRUE + f12 <- paste0("f_", n1, "_to_", n2) + k2 <- paste0("k_", n2) + predicted_text[n2] <- paste0( + "((", f12, "* g - ", f12, ") * k2 * ", n10, " * exp(- k2 * t))/(k2 - ", k2, ") - ", + "((", f12, "* g) * k1 * ", n10, " * exp(- k1 * t))/(k1 - ", k2, ") + ", + "(((k1 - ", k2, ") * k2 - ", k2, "* k1 + ", k2, "^2) * ", n20, "+", + "((", f12, "* k1 + (", f12, "*g - ", f12, ") * ", k2, ") * k2 - ", f12, " * g * ", k2, " * k1) * ", n10, ") * ", + "exp( - ", k2, " * t)/((k1 - ", k2, ") * k2 - ", k2, " * k1 + ", k2, "^2)") + } + } |