Skip to content

Commit

Permalink
disc05 built
Browse files Browse the repository at this point in the history
  • Loading branch information
abel-seyoum committed Oct 31, 2023
1 parent 20c487d commit f354794
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 66 deletions.
134 changes: 69 additions & 65 deletions docs/disc05/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
width: 0.8em;
margin: 0 0.8em 0.2em -1.6em;
vertical-align: middle;
}
/* CSS for syntax highlighting */
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
Expand Down Expand Up @@ -50,7 +56,7 @@
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.bu { color: #008000; } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
Expand All @@ -63,7 +69,7 @@
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { } /* Import */
code span.im { color: #008000; font-weight: bold; } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
Expand Down Expand Up @@ -179,7 +185,7 @@ <h2 class="accordion-header" id="heading1_1">
Click to view the solution.
</button>
</h2>
<div id="collapse1_1" class="accordion-collapse collapse collapse"
<div id="collapse1_1" class="accordion-collapse collapse"
aria-labelledby="heading1_1" data-bs-parent="#accordionExample">
<div class="accordion-body">
<header id="title-block-header">
Expand Down Expand Up @@ -215,7 +221,7 @@ <h2 class="accordion-header" id="heading1_2">
Click to view the solution.
</button>
</h2>
<div id="collapse1_2" class="accordion-collapse collapse collapse"
<div id="collapse1_2" class="accordion-collapse collapse"
aria-labelledby="heading1_2" data-bs-parent="#accordionExample">
<div class="accordion-body">
<header id="title-block-header">
Expand Down Expand Up @@ -255,7 +261,7 @@ <h2 class="accordion-header" id="heading1_3">
Click to view the solution.
</button>
</h2>
<div id="collapse1_3" class="accordion-collapse collapse collapse"
<div id="collapse1_3" class="accordion-collapse collapse"
aria-labelledby="heading1_3" data-bs-parent="#accordionExample">
<div class="accordion-body">
<header id="title-block-header">
Expand Down Expand Up @@ -325,7 +331,7 @@ <h2 class="accordion-header" id="heading2_1">
Click to view the solution.
</button>
</h2>
<div id="collapse2_1" class="accordion-collapse collapse collapse"
<div id="collapse2_1" class="accordion-collapse collapse"
aria-labelledby="heading2_1" data-bs-parent="#accordionExample">
<div class="accordion-body">
<header id="title-block-header">
Expand Down Expand Up @@ -367,7 +373,7 @@ <h2 class="accordion-header" id="heading2_2">
Click to view the solution.
</button>
</h2>
<div id="collapse2_2" class="accordion-collapse collapse collapse"
<div id="collapse2_2" class="accordion-collapse collapse"
aria-labelledby="heading2_2" data-bs-parent="#accordionExample">
<div class="accordion-body">
<header id="title-block-header">
Expand Down Expand Up @@ -422,7 +428,7 @@ <h2 class="accordion-header" id="heading2_3">
Click to view the solution.
</button>
</h2>
<div id="collapse2_3" class="accordion-collapse collapse collapse"
<div id="collapse2_3" class="accordion-collapse collapse"
aria-labelledby="heading2_3" data-bs-parent="#accordionExample">
<div class="accordion-body">
<header id="title-block-header">
Expand All @@ -449,113 +455,111 @@ <h5>Difficulty: ⭐️</h5>
<p><br></p>
<hr />
<h2 id="problem-3">Problem 3</h2>
<p>You generate a three-digit number by randomly choosing each digit to
be a number 0 through 9, inclusive. Each digit is equally likely to be
chosen.</p>
<p>Each individual penguin in our dataset is of a certain species
(Adelie, Chinstrap, or Gentoo) and comes from a particular island in
Antarctica (Biscoe, Dream, or Torgerson). There are 330 penguins in our
dataset, grouped by species and island as shown below.</p>
<center><img src='../assets/images/fa21-final/dream_form.png' width=20%></center>
<p><br></p>
<p>Suppose we pick one of these 330 penguins, uniformly at random, and
name it Chester.</p>
<p><br></p>
<h3 id="problem-3.1">Problem 3.1</h3>
<p>What is the probability you produce the number <strong>027</strong>?
Give your answer as a decimal number between 0 and 1 with no
rounding.</p>
<p>What is the probability that Chester comes from Dream island? Give
your answer as a number between 0 and 1, rounded to three decimal
places.</p>
<div id="accordionExample" class="accordion">
<div class="accordion-item">
<h2 class="accordion-header" id="heading3_1">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapse3_1" aria-expanded="true" aria-controls="collapse3_1">
Click to view the solution.
</button>
</h2>
<div id="collapse3_1" class="accordion-collapse collapse collapse"
<div id="collapse3_1" class="accordion-collapse collapse"
aria-labelledby="heading3_1" data-bs-parent="#accordionExample">
<div class="accordion-body">
<header id="title-block-header">
<h1 class="title"> </h1>
</header>
<p><strong>Answer: </strong> 0.001</p>
<p>There is a <span class="math inline">\frac{1}{10}</span> chance that
we get 0 as the first random number, a <span class="math inline">\frac{1}{10}</span> chance that we get 2 as the
second random number, and a <span class="math inline">\frac{1}{10}</span> chance that we get 7 as the
third random number. The probability of all of these events happening is
<span class="math inline">\frac{1}{10}*\frac{1}{10}*\frac{1}{10} =
0.001</span>.</p>
<p>Another way to do this problem is to think about the possible
outcomes. Any number from 000 to 999 is possible and all are equally
likely. Since there are 1000 possible outcomes and the number 027 is
just one of the possible outcomes, the probability of getting this
outcome is <span class="math inline">\frac{1}{1000} = 0.001</span>.</p>
<p><strong>Answer:</strong> 0.373</p>
<p>P(Chester comes from Dream island) = # of penguins in dream island
<span class="math inline">/</span> # of all penguins in the data = <span class="math inline">\frac{55+68}{330} \approx 0.373</span></p>
<hr/>
<h5>Difficulty: ⭐️</h5>
<p>
</p>
<p>The average score on this problem was 92%.</p>
<p>The average score on this problem was 94%.</p>
</div>
</div>
</div>
</div>
<p><br></p>
<h3 id="problem-3.2">Problem 3.2</h3>
<p>What is the probability you produce a number with an odd digit in the
middle position? For example, <strong>250</strong>. Give your answer as
a decimal number between 0 and 1 with no rounding.</p>
<p>If we know that Chester comes from Dream island, what is the
probability that Chester is an Adelie penguin? Give your answer as a
number between 0 and 1, rounded to three decimal places.</p>
<div id="accordionExample" class="accordion">
<div class="accordion-item">
<h2 class="accordion-header" id="heading3_2">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapse3_2" aria-expanded="true" aria-controls="collapse3_2">
Click to view the solution.
</button>
</h2>
<div id="collapse3_2" class="accordion-collapse collapse collapse"
<div id="collapse3_2" class="accordion-collapse collapse"
aria-labelledby="heading3_2" data-bs-parent="#accordionExample">
<div class="accordion-body">
<header id="title-block-header">
<h1 class="title"> </h1>
</header>
<p><strong>Answer: </strong> 0.5</p>
<p>Because the values of the left and right positions are not important
to us, think of the middle position only. When selecting a random number
to go here, we are choosing randomly from the numbers 0 through 9. Since
5 of these numbers are odd (1, 3, 5, 7, 9), the probability of getting
an odd number is <span class="math inline">\frac{5}{10} =
0.5</span>.</p>
<p><strong>Answer:</strong> 0.447</p>
<p>P(Chester is an Adelie penguin given that Chester comes from Dream
island) = # of Adelie penguins from Dream island <span class="math inline">/</span> # of penguins from Dream island = <span class="math inline">\frac{55}{55+68} \approx 0.447</span></p>
<hr/>
<h5>Difficulty: ⭐️⭐️</h5>
<h5>Difficulty: ⭐️</h5>
<p>
</p>
<p>The average score on this problem was 78%.</p>
<p>The average score on this problem was 91%.</p>
</div>
</div>
</div>
</div>
<p><br></p>
<h3 id="problem-3.3">Problem 3.3</h3>
<p>What is the probability you produce a number with a
<strong>7</strong> in it somewhere? Give your answer as a decimal number
between 0 and 1 with no rounding.</p>
<p>If we know that Chester is not from Dream island, what is the
probability that Chester is not an Adelie penguin? Give your answer as a
number between 0 and 1, rounded to three decimal places.</p>
<div id="accordionExample" class="accordion">
<div class="accordion-item">
<h2 class="accordion-header" id="heading3_3">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapse3_3" aria-expanded="true" aria-controls="collapse3_3">
Click to view the solution.
</button>
</h2>
<div id="collapse3_3" class="accordion-collapse collapse collapse"
<div id="collapse3_3" class="accordion-collapse collapse"
aria-labelledby="heading3_3" data-bs-parent="#accordionExample">
<div class="accordion-body">
<header id="title-block-header">
<h1 class="title"> </h1>
</header>
<p><strong>Answer: </strong> 0.271</p>
<p>It’s easier to calculate the probability that the number has no 7 in
it, and then subtract this probability from 1. To solve this problem
directly, we’d have to consider cases where 7 appeared multiple times,
which would be more complicated.</p>
<p>The probability that the resulting number has no 7 is <span class="math inline">\frac{9}{10}*\frac{9}{10}*\frac{9}{10} =
0.729</span> because in each of the three positions, there is a <span class="math inline">\frac{9}{10}</span> chance of selecting something
other than a 7. Therefore, the probability that the number has a 7 is
<span class="math inline">1 - 0.729 = 0.271</span>. </p>
<p><strong>Answer:</strong> 0.575</p>
<p>Method 1</p>
<p>P(Chester is not an Adelie penguin given that Chester is not from
Dream island) = # of penguins that are not Adelie penguins from islands
other than Dream island <span class="math inline">/</span> # of penguins
in island other than Dream island = <span class="math inline">\frac{119\
\text{(eliminate all penguins that are Adelie or from Dream island, only
Gentoo penguins from Biscoe are left)}}{44+44+119} \approx
0.575</span></p>
<p>Method 2</p>
<p>P(Chester is not an Adelie penguin given that Chester is not from
Dream island) = 1- (# of penguins that are Adelie penguins from islands
other than Dream island <span class="math inline">/</span> # of penguins
in island other than Dream island) = <span class="math inline">1-\frac{44+44}{44+44+119} \approx 0.575</span></p>
<hr/>
<h5>Difficulty:
⭐️⭐️⭐️</h5>
<p>The average score on this problem was 69%.</p>
<h5>Difficulty: ⭐️⭐️</h5>
<p>
</p>
<p>The average score on this problem was 85%.</p>
</div>
</div>
</div>
Expand Down Expand Up @@ -600,7 +604,7 @@ <h2 class="accordion-header" id="heading4_1">
Click to view the solution.
</button>
</h2>
<div id="collapse4_1" class="accordion-collapse collapse collapse"
<div id="collapse4_1" class="accordion-collapse collapse"
aria-labelledby="heading4_1" data-bs-parent="#accordionExample">
<div class="accordion-body">
<header id="title-block-header">
Expand Down Expand Up @@ -651,7 +655,7 @@ <h2 class="accordion-header" id="heading4_2">
Click to view the solution.
</button>
</h2>
<div id="collapse4_2" class="accordion-collapse collapse collapse"
<div id="collapse4_2" class="accordion-collapse collapse"
aria-labelledby="heading4_2" data-bs-parent="#accordionExample">
<div class="accordion-body">
<header id="title-block-header">
Expand Down Expand Up @@ -697,7 +701,7 @@ <h2 class="accordion-header" id="heading4_3">
Click to view the solution.
</button>
</h2>
<div id="collapse4_3" class="accordion-collapse collapse collapse"
<div id="collapse4_3" class="accordion-collapse collapse"
aria-labelledby="heading4_3" data-bs-parent="#accordionExample">
<div class="accordion-body">
<header id="title-block-header">
Expand Down Expand Up @@ -735,7 +739,7 @@ <h2 class="accordion-header" id="heading5_1">
Click to view the solution.
</button>
</h2>
<div id="collapse5_1" class="accordion-collapse collapse collapse"
<div id="collapse5_1" class="accordion-collapse collapse"
aria-labelledby="heading5_1" data-bs-parent="#accordionExample">
<div class="accordion-body">
<header id="title-block-header">
Expand Down Expand Up @@ -775,7 +779,7 @@ <h2 class="accordion-header" id="heading5_2">
Click to view the solution.
</button>
</h2>
<div id="collapse5_2" class="accordion-collapse collapse collapse"
<div id="collapse5_2" class="accordion-collapse collapse"
aria-labelledby="heading5_2" data-bs-parent="#accordionExample">
<div class="accordion-body">
<header id="title-block-header">
Expand Down Expand Up @@ -823,7 +827,7 @@ <h2 class="accordion-header" id="heading6">
Click to view the solution.
</button>
</h2>
<div id="collapse6" class="accordion-collapse collapse collapse"
<div id="collapse6" class="accordion-collapse collapse"
aria-labelledby="heading6" data-bs-parent="#accordionExample">
<div class="accordion-body">
<header id="title-block-header">
Expand Down
2 changes: 1 addition & 1 deletion pages/disc/disc05.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ show_solution: true
problems:
- fa21-midterm/q8-airlines-disc05
- fa21-midterm/q9-snack-time
- wi21-midterm/q12-random-number
- fa21-final/q8-dream-island
- sp22-midterm/q11-simulation
- sp22-midterm/q12-probability
- wi21-midterm/q14-results-array

0 comments on commit f354794

Please sign in to comment.