timcdlucas / RandEM

Random Encounter Modelling in R

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Numeric instability at small numbers

timcdlucas opened this issue · comments

Worth checking this more carefully at some point.

This one is ok (top right corner of Fig 4 in gREM paper, i.e. gas model).

count <- 2
v = 20
tm_days = 2
r_kilometers <- 1
theta <- 2 * pi
p <- r_kilometers*(theta + 2*sin(theta/2))/pi

D <- count / {v * tm_days * p}


p_exact <- r_kilometers*2

D2 <- count / {v * tm_days * p_exact}

Bottom right looks like it might behave weirdly.