1. Write an accept/reject sampler to generate uniform samples from the unit disk in two dimensions. Recall that the unit disk is characterized by \{(x,y) s.t. x^2 + y^2 \leq 1\}. What is the efficiency of your sampler?
  2. Implement any other algorithm for generating uniform samples from the unit disk in two dimensions.
  3. Plot the samples that you generated and visually confirm that they are indeed uniformly distributed.
  4. Write a sampler to generate samples from the density p(x)=\frac{\alpha \beta^\alpha}{x^{\alpha+1}} for x \geq \beta using the inverse transform.
  5. Download your favorite Shakespear play from http://openshakespeare.org/ and save it in a text file. Read the file and annotate each line with the line number and write the result back into another text file. You need to skip blank lines. For instance if you input text is

All's Well, that Ends Well

Actus primus. Scoena Prima.

Enter yong Bertram Count of Rossillion, his Mother, and Helena, Lord Lafew, all in blacke.

Your output text must be

1 All's Well, that Ends Well

2 Actus primus. Scoena Prima.

3 Enter yong Bertram Count of Rossillion, his Mother, and Helena, Lord Lafew, all in blacke.

Think about your logic before implementing all programs in this lab.

SOLUTIONS : week7.docx

 
Back to top
courses/fall2011/598z/lab/week7.txt · Last modified: 2011/10/22 00:24 by slakshma
 
 
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0