Homework 0 is out now. The goal of this assignment is to get you familiar with Python, its plotting environment, and to gain some first hand experience with random variables and their distributions. Please submit a single PDF file of your solution to Compass.

We appreciate if you can typeset your solution using LaTeX, we have prepared a template that you can use for your submissions.

Due Date: Tuesday 09/04 at 11:59 pm.

Helpful code

To save you time, you might find the below code snippet helpful for Exercise 2.

from scipy.stats import expon, gamma
import matplotlib.pyplot as plt
import numpy as np
import argparse 

def try_expo(n):
    """Write your code here!"""

def try_gamma(n):
    """Write your code here!"""

if __name__ == '__main__':
    parser = argparse.ArgumentParser()

    parser.add_argument("-n", default=1000, type=int,
                        help="Number of random variables")
    parser.add_argument("-e", "--expo", default=True, action="store_true",
                        help="Use exponential distribution")
    parser.add_argument("-g", "--gamma", default=False, action="store_true",
                        help="Use gamma distribution")

    args = parser.parse_args()

    print "Plotting pdf of a summation of {} independent {} rvs".format(
        args.n, ('gamma' if args.gamma else 'exponential'))
    if args.gamma:
        try_gamma(args.n)
    else:
        try_expo(args.n)

For exercise 3, you might find the below code snippet helpful in defining your own random variable.

from scipy.stats import rv_continuous, expon
import numpy as np
import matplotlib.pyplot as plt

class ece541_rv(rv_continuous):
    def __init__(self):
        super(ece541_rv, self).__init__()