Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined behavior in pk1 when KA=CL/V #1179

Open
toddyoder opened this issue Mar 14, 2024 · 1 comment
Open

Undefined behavior in pk1 when KA=CL/V #1179

toddyoder opened this issue Mar 14, 2024 · 1 comment

Comments

@toddyoder
Copy link

The concentrations in the closed form pk1 model appear to be either all zeros or NaN when KA is chosen to be equal to CL/V.

library(dplyr)
library(mrgsolve)

# KA != CL/V
modlib("pk1") %>% 
  param(CL = 0.391, V = 30, KA = 0.013) %>% 
  ev(amt = 100) %>% 
  mrgsim() %>% 
  as_tibble %>% 
  pull(CENT) %>% 
  summary

# KA = CL/V
modlib("pk1") %>% 
  param(CL = 0.39, V = 30, KA = 0.013) %>% 
  ev(amt = 100) %>% 
  mrgsim() %>% 
  as_tibble %>% 
  pull(CENT) %>% 
  summary

# KA = CL/V
modlib("pk1") %>% 
  param(CL = 1, V = 20, KA = 0.05) %>% 
  ev(amt = 100) %>% 
  mrgsim() %>% 
  as_tibble %>% 
  pull(CENT) %>% 
  summary
Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
0.000   6.371  12.868  12.162  18.312  22.829 

Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
0       0       0       0       0       0 

Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
0       0       0       0       0       0      24 
@kylebaron kylebaron changed the title Incorrect concentrations in pk1 when KA=CL/V Undefined behavior in pk1 when KA=CL/V Mar 14, 2024
@kylebaron
Copy link
Collaborator

kylebaron commented Mar 14, 2024

a[0] = ka/(ka-alpha[0]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants