Skip to content

Commit

Permalink
Merge pull request #45 from vianneydenis/monkey
Browse files Browse the repository at this point in the history
Loop updated
  • Loading branch information
vianneydenis authored Oct 23, 2023
2 parents 6747753 + 0438ac1 commit 0d5deac
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions df4810487c8a45838b57b12f305a2529def7225f/Logi_G.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Logistic growth

grow <- function (growth.rate, num_gen) {
N <- rep (0,num_gen)
generation=rep(0,num_gen)
generation[1]=1
N[1] <- 10
for (i in 2:num_gen) {
N[i]= N[i-1]+(growth.rate * N[i-1] * ((100-
N[i-1])/100))
generation [i]=i
}
plot(N~generation, type='b')
}
grow (0.1,50)
grow (0.5,50)
grow (1.3,50)
grow (2.52,50)
grow (3,50)

saveGIF({
for (i in 1:length(seq(0.1,3, 0.1))){
a<-seq(0.1,3, 0.1)[i]
grow(a,50)
}
}, interval = 0.3, ani.width = 950, ani.height = 550)
1 change: 1 addition & 0 deletions df4810487c8a45838b57b12f305a2529def7225f/loop.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -312,5 +312,6 @@ grow(1,2)
text(6,110,"Both Species competing")
```

![](Figures/Lotka.png)


3 changes: 2 additions & 1 deletion df4810487c8a45838b57b12f305a2529def7225f/loop.html

Large diffs are not rendered by default.

0 comments on commit 0d5deac

Please sign in to comment.