- Exponential Growth
- Birth and Death Model
- Visualizing it All
2025-09-22
\[ N(t) = N_0 e^{rt} \]
\[ r = b - d \quad \quad \frac{dN}{dt} = rN \]
library (ggplot2)
time <- 2:30
N0 <- 50
r <- 0.3
N <- N0 * exp(r * time)
df <- data.frame(time, N)
ggplot(df, aes(time, N)) +
geom_line(color="black") +
labs(title = "Exponential Growth Graph",
x="Time",
y="Population")
-This graph shows us the green populations growing, the blue populations staying stable, and the red populations decreasing. Obviously, it isn’t this rigid in real life.
time <- 2:30
N0 <- 50
df <- data.frame(
time = time,
growth = N0 * exp(0.2 * time),
decline = N0 * exp(-0.2 * time),
stable = N0 * exp(0 * time))
ggplot() +
geom_line(data=df, aes(time, growth), color="green") +
geom_line(data=df, aes(time, decline), color="red") +
geom_line(data=df, aes(time, stable), color="blue") +
scale_y_log10() +
labs(title="Birth and Death Model",
x="Time",
y = "Population")
library(plotly)
time <- 2:30
N0 <- 20
r <- 0.3
population <- N0 * exp(r * time)
plot_ly(x = ~time, y = ~population, type = 'scatter', mode = 'lines+markers') %>%
layout(title = "Population Growth Plotly",
xaxis = list(title = "Time"),
yaxis = list(title = "Population"))