Skip to content

Commit

Permalink
bayes exercise
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderthclark committed Mar 18, 2024
1 parent 3ecd2d4 commit 58d8d17
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 1 deletion.
Binary file modified book/_build/.doctrees/bayes.doctree
Binary file not shown.
Binary file modified book/_build/.doctrees/environment.pickle
Binary file not shown.
36 changes: 36 additions & 0 deletions book/_build/html/_sources/bayes.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,5 +239,41 @@ The [provided spreadsheet](https://docs.google.com/spreadsheets/d/1-edxFvawj8f6v
3. Chance a song mentions "tractor" given that it mentions "truck."
4. Chance a song mentions "truck" given that it mentions "tractor."

```{exercise-end}
```

```{exercise-start}
:label: troll2
```

A pilgrim, traveling home, is wandering through a strange land when a troll appears:

> *Woe, to pass, you must choose of these doors three.<br>
Each leads home with some probability. <br>
Chances 0, 50, and 100 less ten.<br>
Independent but the order I cannot lend.<br>
Choose traveler, lest in exile you stay.<br>
Take three draws before I turn thee away.*

1. If the first draw does not lead home, what is the probability the pilgrim opened the door that leads home with chance 0\%?
2. If the first draw does not lead home, what is the probability the pilgrim opened the door that leads home with chance 50\%?
3. If the first draw does not lead home, what is the probability the pilgrim opened the door that leads home with chance 90\%?

4. If the first draw does not lead home, should the pilgrim open a different door on the next draw or try the same door again?

5. The troll, now old in his years, has seen 12 million pilgrims pass through. Each has chosen a door randomly to start and then randomly chosen a different door second if the first doesn't take them home. Finish filling in the table below with the expected counts.

| | Door 0 second | Door 50 second | Door 90 second | Home after first |
|-------------------|---------------|----------------|------------------|-------------------|
| Door 0 first | 0 million | | | 0 million |
| Door 50 first | | 0 million | | 2 million |
| Door 90 first | | | 0 million | 3.6 million |


6. If the second draw does not lead home, should the pilgrim open a different door on the next draw?
7. What is the probability that the pilgrim remains in exile?
8. The pilgrim, alarmed by the risk of remaining in exile, bargains with the troll to replace the 0\% and 90\% chance doors with two 45\% chance doors. Is this wise?
9. The pilgrim, alarmed by the risk of remaining in exile, bargains with the troll to replace the 0\% and 90\% chance doors with two 80\% chance doors. Is this wise?

```{exercise-end}
```
58 changes: 58 additions & 0 deletions book/_build/html/bayes.html
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,64 @@ <h2>Exercises<a class="headerlink" href="#exercises" title="Permalink to this he
</ol>
</section>
</div>
<div class="exercise admonition" id="troll2">

<p class="admonition-title"><span class="caption-number">Exercise 38 </span></p>
<section id="exercise-content">
<p>A pilgrim, traveling home, is wandering through a strange land when a troll appears:</p>
<blockquote>
<div><p><em>Woe, to pass, you must choose of these doors three.<br>
Each leads home with some probability. <br>
Chances 0, 50, and 100 less ten.<br>
Independent but the order I cannot lend.<br>
Choose traveler, lest in exile you stay.<br>
Take three draws before I turn thee away.</em></p>
</div></blockquote>
<ol class="arabic simple">
<li><p>If the first draw does not lead home, what is the probability the pilgrim opened the door that leads home with chance 0%?</p></li>
<li><p>If the first draw does not lead home, what is the probability the pilgrim opened the door that leads home with chance 50%?</p></li>
<li><p>If the first draw does not lead home, what is the probability the pilgrim opened the door that leads home with chance 90%?</p></li>
<li><p>If the first draw does not lead home, should the pilgrim open a different door on the next draw or try the same door again?</p></li>
<li><p>The troll, now old in his years, has seen 12 million pilgrims pass through. Each has chosen a door randomly to start and then randomly chosen a different door second if the first doesn’t take them home. Finish filling in the table below with the expected counts.</p></li>
</ol>
<table class="table">
<thead>
<tr class="row-odd"><th class="head"><p></p></th>
<th class="head"><p>Door 0 second</p></th>
<th class="head"><p>Door 50 second</p></th>
<th class="head"><p>Door 90 second</p></th>
<th class="head"><p>Home after first</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>Door 0 first</p></td>
<td><p>0 million</p></td>
<td><p></p></td>
<td><p></p></td>
<td><p>0 million</p></td>
</tr>
<tr class="row-odd"><td><p>Door 50 first</p></td>
<td><p></p></td>
<td><p>0 million</p></td>
<td><p></p></td>
<td><p>2 million</p></td>
</tr>
<tr class="row-even"><td><p>Door 90 first</p></td>
<td><p></p></td>
<td><p></p></td>
<td><p>0 million</p></td>
<td><p>3.6 million</p></td>
</tr>
</tbody>
</table>
<ol class="arabic simple" start="6">
<li><p>If the second draw does not lead home, should the pilgrim open a different door on the next draw?</p></li>
<li><p>What is the probability that the pilgrim remains in exile?</p></li>
<li><p>The pilgrim, alarmed by the risk of remaining in exile, bargains with the troll to replace the 0% and 90% chance doors with two 45% chance doors. Is this wise?</p></li>
<li><p>The pilgrim, alarmed by the risk of remaining in exile, bargains with the troll to replace the 0% and 90% chance doors with two 80% chance doors. Is this wise?</p></li>
</ol>
</section>
</div>
</section>
</section>

Expand Down
Binary file modified book/_build/html/objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion book/_build/html/searchindex.js

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions book/bayes.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,5 +239,41 @@ The [provided spreadsheet](https://docs.google.com/spreadsheets/d/1-edxFvawj8f6v
3. Chance a song mentions "tractor" given that it mentions "truck."
4. Chance a song mentions "truck" given that it mentions "tractor."

```{exercise-end}
```

```{exercise-start}
:label: troll2
```

A pilgrim, traveling home, is wandering through a strange land when a troll appears:

> *Woe, to pass, you must choose of these doors three.<br>
Each leads home with some probability. <br>
Chances 0, 50, and 100 less ten.<br>
Independent but the order I cannot lend.<br>
Choose traveler, lest in exile you stay.<br>
Take three draws before I turn thee away.*

1. If the first draw does not lead home, what is the probability the pilgrim opened the door that leads home with chance 0\%?
2. If the first draw does not lead home, what is the probability the pilgrim opened the door that leads home with chance 50\%?
3. If the first draw does not lead home, what is the probability the pilgrim opened the door that leads home with chance 90\%?

4. If the first draw does not lead home, should the pilgrim open a different door on the next draw or try the same door again?

5. The troll, now old in his years, has seen 12 million pilgrims pass through. Each has chosen a door randomly to start and then randomly chosen a different door second if the first doesn't take them home. Finish filling in the table below with the expected counts.

| | Door 0 second | Door 50 second | Door 90 second | Home after first |
|-------------------|---------------|----------------|------------------|-------------------|
| Door 0 first | 0 million | | | 0 million |
| Door 50 first | | 0 million | | 2 million |
| Door 90 first | | | 0 million | 3.6 million |


6. If the second draw does not lead home, should the pilgrim open a different door on the next draw?
7. What is the probability that the pilgrim remains in exile?
8. The pilgrim, alarmed by the risk of remaining in exile, bargains with the troll to replace the 0\% and 90\% chance doors with two 45\% chance doors. Is this wise?
9. The pilgrim, alarmed by the risk of remaining in exile, bargains with the troll to replace the 0\% and 90\% chance doors with two 80\% chance doors. Is this wise?

```{exercise-end}
```

0 comments on commit 58d8d17

Please sign in to comment.