Programming assignment with checks#
This page shows how you can recreate the classical Jupyter Notebook assignments that are given in many courses to a Jupyter Book format with live coding. A widget has been implemented to check the answers, of which the data is included in a separate python file. The page automatically loads and a custom download page has been added
Note
Keep in mind that Jupyter Book sections might not be the best environment for programming assignments you have in mind for your course due to the limitation posed by jupyter book. In fact, in jupyter book, python runs in the browser of the students’ laptop. Nothing needs to be installed which can be an advantage but also a disadvantage depending on the learning goals of your course. TeachBooks suggests using it’s live coding feature to support the theory in textbooks and not as a replacement for Jupyter Notebook.
Gumbel Distribution Exercise#
Imagine you are concerned with the concentration of an airborne contaminant,
Using the cell blocks below as a guide (and also to check your analysis): Task 1) find the parameters of a Gumbel distribution that matches the information provided above, then, Tasks 2-3) use it to estimate the concentration with exceedance probability 0.1%.
To complete this assignment, you can use numpy
, matplotlib
and from the math
library, log
and e
(these are imported for you when you inialize the notebook).
Task 0: fill in the appropriate fitting points:
x_1 = _
Task 1: derive the distribution parameters:
"""Compute Gumbel distribution parameters from two points of the CDF.
The cells below will print your parameter values and create a plot to help confirm you have the right implementation.
gumbel_distribution = lambda x: 1 - e**(-e**(-(x - mu)/beta))
Task 2: write a function to solve for the random variable value (it will be tested for you with the Check answer button, along with the distribution parameters).
""" Compute point in the gumbel distribution for which the CDF is p
Task 3: use the function find_x_with_probability_p
to evaluate the random variable value with exceedance probabiltiy of 0.001.
print(f"The value of x with probability of exceedance 0.001 os {x:0.5f}")