Skip to content

Instantly share code, notes, and snippets.

@jebyrnes
Created March 18, 2024 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jebyrnes/9572012063599110d3decb68dcc3154e to your computer and use it in GitHub Desktop.
Save jebyrnes/9572012063599110d3decb68dcc3154e to your computer and use it in GitHub Desktop.
playing with sublinear growth rate
#sublinear
library(deSolve)
# adapted from
# https://hankstevens.github.io/Primer-of-Ecology/DDgrowth.html
sublinear <- function(t, y, p){
bi <- y[1]
dN.dt <- with(as.list(p),
r*b0^(1-k)*bi^k - z*bi
)
return(list( dN.dt ))
}
p <- c(r = 1, k = 3/4, b0 = 1, z = 0.5)
y0 <- c(N=1)
tsteps = 0:50
out <- ode(y=y0, times=tsteps, func=sublinear, parms=p)
plot(N ~ time, data = out)
# equilibrium
with(as.list(p),
(z/r*b0^(1-k))^(1/(k-1)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment