Skip to content

Commit

Permalink
differences for PR #681
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jun 12, 2024
1 parent b731c69 commit fb01ecb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions 16-writing-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -573,21 +573,25 @@ density. In the model, time takes discrete values 0, 1, 2, ...

## Solution

1. ```python
1.
```python
def logistic_map(x, r):
return r * x * (1 - x)
```

2. ```python
2.
```python
initial_population = 0.5
t_final = 10
r = 1.0
population = [initial_population]

for t in range(t_final):
population.append( logistic_map(population[t], r) )
```

3. ```python
3.
```python
def iterate(initial_population, t_final, r):
population = [initial_population]
for t in range(t_final):
Expand All @@ -598,7 +602,7 @@ density. In the model, time takes discrete values 0, 1, 2, ...
population = iterate(0.5, period, 1)
print(population[-1])
```

```output
0.06945089389714401
0.009395779870614648
Expand Down
2 changes: 1 addition & 1 deletion md5sum.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"episodes/13-conditionals.md" "2739086f688f386c32ce56400c6b27e2" "site/built/13-conditionals.md" "2024-02-16"
"episodes/14-looping-data-sets.md" "fb2992c34b244b375302ffb15bd25b8d" "site/built/14-looping-data-sets.md" "2024-03-05"
"episodes/15-coffee.md" "062bae79eb17ee57f183b21658a8d813" "site/built/15-coffee.md" "2023-05-02"
"episodes/16-writing-functions.md" "0f162f45b0072659b0113baf01ade027" "site/built/16-writing-functions.md" "2023-07-24"
"episodes/16-writing-functions.md" "a87b7fd96770bd8c24d695ef529b93ce" "site/built/16-writing-functions.md" "2024-06-12"
"episodes/17-scope.md" "8109afb18f278a482083d867ad80da6e" "site/built/17-scope.md" "2023-05-02"
"episodes/18-style.md" "67f9594a062909ef15132811d02ee6a0" "site/built/18-style.md" "2023-07-29"
"episodes/19-wrap.md" "8863b58685fecbc89a6f5058bde50307" "site/built/19-wrap.md" "2023-05-02"
Expand Down

0 comments on commit fb01ecb

Please sign in to comment.