REMINDER!!!

Before doing anything,

  1. Make a copy of this notebook in your clone of the private course repository. Edit that copy, not the version in the public repository clone.

  2. Remember that you will submit your solution by pull request to the private repository.

Once you've submitted your solution, don't forget to also fill out the very quick (and required!) weekly feedback form.

This week's assignment is relatively quick and easy, just to ensure that everyone is up to speed on probability and computing.

Week 1 Homework

Change of Variables

Recall the formula for variable transformation as applied to probability density functions:

$p(y) = p(x)\left|\frac{dx}{dy}\right|$

Consider the function $b=\tan(\theta)$, which is sometimes used to reparametrize the slope of a line ($b$) with the angle the line makes in a plot or $x$ vs $y$ ($\theta$).

  1. If $p(\theta)$ is uniform (proportional to a constant) on $-\frac{\pi}{2} < \theta < \frac{\pi}{2}$, work out $p(b)$.

  2. Demonstrate that you're correct by generating a bunch of uniform random $\theta$'s, transforming each one to its corresponding $b$, and comparing a histogram of $b$ with your answer to (1).

  3. Now try the reverse problem: find $p(\theta)$ if $p(b)$ is taken to be uniform (say over $-100<b<100$).

  4. Compare your answer to (2) with a histogram of transformed samples from $p(b)$.


In [ ]: