fork/numbat

git clone https://git.julia.blue/fork/numbat

David PeterAdd pop. growth examplef40f388

v1.6.3
387 B11 linesraw
1# Exponential model for population growth
2
3let initial_population = 50_000 people
4let growth_rate = 2% per year
5
6fn predict_population(t: Time) =
7    initial_population × e^(growth_rate·t) // round
8
9print("Population in  20 years: {predict_population(20 years)}")
10print("Population in 100 years: {predict_population(1 century)}")
11assert_eq(predict_population(20 years), 74_591 people)