-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from project-lovelace/ali/new-batch
- Loading branch information
Showing
19 changed files
with
512 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
cd src/ | ||
docker-compose build | ||
docker-compose up --detach | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{% extends "problems/problem.html" %} | ||
|
||
{% load static %} | ||
|
||
{% block you_will_learn %} | ||
the most powerful force in the world according to Einstein. <sup>[<a href="https://quoteinvestigator.com/2019/09/09/interest/">citation needed</a>]</sup> | ||
{% endblock %} | ||
|
||
{% block problem_body %} | ||
<p class="has-text-justified"> | ||
Compound interest is when interest on a loan or investment is added back to the loan or investment. So it's like | ||
interest on interest! Compounding leads to exponential growth so it makes your investments grow big over time but | ||
also makes it much harder to pay off predatory loans and credit card debt. | ||
</p> | ||
<br> | ||
<p class="has-text-justified"> | ||
If you start with an amount of money $m$ and the compound interest is calculated once a year with interest rate $r$ | ||
(as a fraction between 0 and 1) then after $n$ years you end up with a new amount $M$ given by | ||
|
||
$$ M = m (1 + r)^n $$ | ||
</p> | ||
<br> | ||
|
||
This plot shows the growth of $m = 1,000$ dollars compounded every year at 10% ($r = 0.1$) for $n = 25$ years. | ||
|
||
<figure style="text-align: center;"> | ||
<div id="compound-interest-figure"></id> | ||
</figure> | ||
<br> | ||
|
||
<p class="has-text-justified"> | ||
Submit some code with a function <tt>compound_interest(m, r, n)</tt> that computes the final amount $M$ after | ||
starting with an amount $m$ compounded yearly at a rate $r$ for $n$ years. | ||
</p> | ||
{% endblock %} | ||
|
||
{% block input_description %} | ||
Starting amount $m$, rate $r$, and number of years $n$. | ||
{% endblock %} | ||
|
||
{% block output_description %} | ||
Final amount $M$. | ||
{% endblock %} | ||
|
||
{% block examples %} | ||
<article class="message"> | ||
<div class="message-header"> | ||
<p>Example</p> | ||
</div> | ||
<div class="message-body" | ||
style="font-family: monospace; text-align: justify; word-wrap: break-word; white-space:pre;"><b>Input</b>: 1000, 0.07, 25 | ||
<b>Output</b>: 5427.43</div> | ||
</article> | ||
{% endblock %} | ||
|
||
{% block function_signature %} | ||
compound_interest(m, r, n) | ||
{% endblock %} | ||
|
||
{% block notes_and_references %} | ||
<div class="content"> | ||
<h3>Notes</h3> | ||
<ul> | ||
<li> | ||
Charging compound interest on loans was and is still considered a kind of <a href="https://en.wikipedia.org/wiki/Usury">usury</a> | ||
by many religions and societies. The Romans and the Christian Bible condemn charging interest on loans to poor people as | ||
it is seen as a form of exploitation. On the extreme end, Islam forbids the charging of any kind of interest as it sees borrowing | ||
and lending as social transactions aimed at benefiting others and thus should not be profitable. | ||
</li> | ||
<li> | ||
The number $e$ was actually discovered by Jacob Bernoulli in 1683 when investigating compound interest. | ||
Now of course called Euler's number because of <a href="https://en.wikipedia.org/wiki/Stigler%27s_law_of_eponymy">Stigler's law</a>. | ||
</li> | ||
<li> | ||
The <a href="https://en.wikipedia.org/wiki/Rule_of_72">Rule of 72</a> is a quick rule/approximation for figuring | ||
out how long it would take for the amount to double: it's $72/r$ where $r$ is the interest rate as a percentage. | ||
</li> | ||
</ul> | ||
</div> | ||
{% endblock %} | ||
|
||
{% block discourse_topic_id %}x{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{% extends "problems/problem.html" %} | ||
|
||
{% load static %} | ||
|
||
{% block you_will_learn %} | ||
modeling population growth and numerically solving a differential equation. | ||
{% endblock %} | ||
|
||
{% block problem_body %} | ||
<p class="has-text-justified"> | ||
$$ \frac{dP}{dt} = rP \left( 1 - \frac{P}{K} \right) $$ | ||
|
||
$$ P^{n+1} = P^n + \Delta t rP^n \left( 1 - \frac{P^n}{K} \right) $$ | ||
</p> | ||
<br> | ||
|
||
<figure style="text-align: center;"> | ||
<div id="logistic-growth-app"></id> | ||
</figure> | ||
<br> | ||
{% endblock %} | ||
|
||
{% block input_description %} | ||
P^0, \Delta t, r, K, N | ||
{% endblock %} | ||
|
||
{% block output_description %} | ||
P(t) = {P^0, P^1, ..., P^N} | ||
{% endblock %} | ||
|
||
{% block examples %} | ||
<article class="message"> | ||
<div class="message-header"> | ||
<p>Example</p> | ||
</div> | ||
<div class="message-body" | ||
style="font-family: monospace; text-align: justify; word-wrap: break-word; white-space:pre;"><b>Input</b>: $1,000, 0.07, 25 | ||
<b>Output</b>: $5,427.43</div> | ||
</article> | ||
{% endblock %} | ||
|
||
{% block function_signature %} | ||
logistic_growth(P0, dt, r, K, N) | ||
{% endblock %} | ||
|
||
{% block notes_and_references %} | ||
{% endblock %} | ||
|
||
{% block discourse_topic_id %}x{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
{% extends "problems/problem.html" %} | ||
|
||
{% load static %} | ||
|
||
{% block you_will_learn %} | ||
cold moose have more fat | ||
{% endblock %} | ||
|
||
{% block problem_body %} | ||
<p class="has-text-justified"> | ||
Bergmann's rule says that animals living in colder climates tend to be larger in size. Swedish scientists measured | ||
the body mass of different moose populations in Sweden and found that the further north you go, the bigger the moose | ||
get! Taking their data we can fit a line through it to predict the body mass of a moose at some latitude using the | ||
equation | ||
|
||
$$ \text{mass} = a \times \text{latitude} + b $$ | ||
|
||
where $a = 2.757$ and $b = 16.793$. | ||
</p> | ||
<br> | ||
|
||
<figure style="text-align: center;"> | ||
<div id="moose-mass-figure"></id> | ||
</figure> | ||
<br> | ||
|
||
<p class="has-text-justified"> | ||
Submit some code with a function <tt>moose_body_mass(latitude)</tt> that returns the expected body mass of a moose | ||
living at the input latitude using the equation from above. | ||
</p> | ||
{% endblock %} | ||
|
||
{% block input_description %} | ||
Latitude | ||
{% endblock %} | ||
|
||
{% block output_description %} | ||
The expected body mass of a moose living at the input latitude. | ||
{% endblock %} | ||
|
||
{% block examples %} | ||
<article class="message"> | ||
<div class="message-header"> | ||
<p>Example</p> | ||
</div> | ||
<div class="message-body" | ||
style="font-family: monospace; text-align: justify; word-wrap: break-word; white-space:pre;"><b>Input latitude</b>: 60.5 | ||
<b>Output body mass</b>: 183.5915</div> | ||
</article> | ||
{% endblock %} | ||
|
||
{% block function_signature %} | ||
moose_body_mass(latitude) | ||
{% endblock %} | ||
|
||
{% block notes_and_references %} | ||
<div class="content"> | ||
<h3>Notes</h3> | ||
<ul> | ||
<li> | ||
Bergmann's rule is a generalization and so it doesn't apply to every species. In fact many counter-examples to | ||
Bergmann's rule exist but it seems to hold true in many cases (Meiri and Dayan, 2003). | ||
</li> | ||
<li> | ||
The original explanation given by Bergmann (1847) for why animals are larger in colder climates is due to the need to | ||
conserve heat. Since larger animals have a lower surface area to volume ratio, they lose less body heat per | ||
unit mass helping to keep them warmer when it's cold. More recent studies don't support this hypothesis though | ||
(Ashton et al., 2000). | ||
</li> | ||
</ul> | ||
|
||
<h3>References</h3> | ||
<dl> | ||
<dt> | ||
Sand, Cederlund & Danell (1995), <a href="https://doi.org/10.1007/BF00341355"> | ||
Geographical and latitudinal variation in growth patterns and adult body size of Swedish moose (Alces alces)</a>, | ||
Oecologia <b>102</b>, 433–442. | ||
</dt> | ||
<dd>This is where we got the data from.</dd> | ||
<br> | ||
|
||
<dt> | ||
Bergmann (1847), <a href="https://books.google.com/books?id=EHo-AAAAcAAJ&pg=PA3"> | ||
Über die Verhältnisse der Wärmeökonomie der Thiere zu ihrer Grösse</a>, Göttinger Studien <b>3</b>(1), 595–708. | ||
</dt> | ||
<dd> | ||
This is the original article by Bergmann in German at over a 100 pages long! Google translates the title to English | ||
as "About the relation of the heat economy of animals to their size". | ||
</dd> | ||
<br> | ||
|
||
<dt> | ||
Meiri and Dayan (2003), <a href="https://doi.org/10.1046/j.1365-2699.2003.00837.x">On the validity of Bergmann's rule</a>, | ||
Journal of Biogeography <b>30</b>, 331-351. | ||
</dt> | ||
<br> | ||
|
||
<dt> | ||
Ashton, Tracy, & de Queiroz (2000), <a href="https://doi.org/10.1086/303400 "> | ||
Is Bergmann’s Rule Valid for Mammals?</a>, The American Naturalist <b>156</b>(4), 390-415. | ||
</dl> | ||
<br> | ||
</div> | ||
{% endblock %} | ||
|
||
{% block discourse_topic_id %}x{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{% extends "problems/problem.html" %} | ||
|
||
{% load static %} | ||
|
||
{% block you_will_learn %} | ||
genetics and strings. | ||
{% endblock %} | ||
|
||
{% block problem_body %} | ||
<p class="has-text-justified"> | ||
As you learned in <a href"dna-transcription.html">DNA transcription</a>, the first step in converting DNA to proteins | ||
is transcribing the DNA into RNA. The second step is translating the RNA into a chain of amino acids, called a | ||
polypeptide. The process is biochemically complex but the resulting amino acid sequence is quite simple: each set of | ||
three base pairs (called a nucleotide triplet or codon) is translated to a single amino acid. The chart below shows | ||
how to translate each codon to an amino acid. | ||
</p> | ||
<br> | ||
|
||
<figure style="text-align: center;"> | ||
<img style="width: 75%; margin: 0 auto;" src="{% static 'img/codon_table.png' %}"> | ||
<figcaption class="help"> | ||
</figcaption> | ||
</figure> | ||
{% endblock %} | ||
|
||
All sequences begin with the start codon and end with one of the end codons. | ||
|
||
{% block input_description %} | ||
An RNA sequence. | ||
{% endblock %} | ||
|
||
{% block output_description %} | ||
A sequence of amino acids. | ||
{% endblock %} | ||
|
||
{% block examples %} | ||
<article class="message"> | ||
<div class="message-header"> | ||
<p>Example</p> | ||
</div> | ||
<div class="message-body" | ||
style="font-family: monospace; text-align: justify; word-wrap: break-word; white-space:pre;"><b>Input</b>: $1,000, 0.07, 25 | ||
<b>Output</b>: $5,427.43</div> | ||
</article> | ||
{% endblock %} | ||
|
||
{% block function_signature %} | ||
translate(rna) | ||
{% endblock %} | ||
|
||
{% block notes_and_references %} | ||
{% endblock %} | ||
|
||
{% block discourse_topic_id %}x{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
double compound_interest(double amount, double rate, int years) { | ||
double new_amount = 0.0; | ||
|
||
// Your code goes here! | ||
|
||
return new_amount; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
double moose_body_mass(double latitude) { | ||
double mass = 0.0; | ||
|
||
// Your code goes here! | ||
|
||
return mass; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
function compound_interest(amount, rate, years) { | ||
var new_amount = 0 | ||
|
||
// Your code goes here! | ||
|
||
return new_amount | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
function moose_body_mass(latitude) { | ||
var mass = 0 | ||
|
||
// Your code goes here! | ||
|
||
return mass | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
function compound_interest(amount, rate, years) | ||
new_amount = 0 | ||
|
||
# Your code goes here! | ||
|
||
return new_mount | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
function moose_body_mass(latitude) | ||
mass = 0 | ||
|
||
# Your code goes here! | ||
|
||
return mass | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
def compound_interest(amount, rate, years): | ||
new_amount = 0 | ||
|
||
# Your code goes here! | ||
|
||
return new_amount |
Oops, something went wrong.