Homework 2

Due 2020-09-16 by midnight

  1. Study Chapters 5-8 of Shotts.
  2. Look at Oetiker, Partl, Hyna, & Schlegl. Some parts can be skimmed, but others should be read carefully.
  3. Read Chapters 2, 3, 4, 5, & 18 of Jones, Maillardet, & Robinson.
  4. Download the files svproc.cls and spbasic.bst (right click and save file or use wget). The tex file contained in Bad.tex is incomplete. Fill in all the necessary details and make all the necessary changes so that it looks like the fllowing pdf file: Good.pdf. Use R to reproduce the plot based off the data given in the pdf file and replace put your name here with your name. Save the new tex file as 'Good.tex'.
  5. Practice writing code without using loops. Write the following without using loops, including not using apply statement. Save the results in a file labeled noloops.R
  6. This part is designed to help you gain: 1. experience in implementing algorithms, and 2. an appreciation for what happens "behind the scenes" when using functions to simulate random deviates. R has builtin functions for many probability distributions. In two scripts, an R file named 'rdg.R' and a python file named 'rdg.py', write functions that are drop-in replacements for R's builtin functions rnorm, rlnorm, rexp, rpois, rgamma, rchisq, rt, rf, rbeta, rbinom, and rnbinom. A drop-in replacement function not only has the same name as the original function, but also the same argument names in the same order, with the same return type. Your functions may call each other (e.g., you can use your rnorm function to implement your rlnorm function) but they cannot use any random number generation functions in R except runif or in Python except numpy's uniform function. Good references include this file (although, in some cases, it lacks the needed generality), Wikipedia, and general web searching. Note that some of these methods rely on the Box-Muller Transformation and others use the Inverse CDF method.
  7. Submit this homework by committing (only) the requested files in the appropriate directory (i.e., homework/2) and pushing to your central Git repository.