Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit


COMP0043 Numerical Methods for Finance

Assignment 2, to be done after Section 3 Random numbers

1. MATLAB provides a high-quality uniform random number generator rand, but you can write a simple one on your own.

(a) Implement a linear congruential random number generator following the in- structions in Seydel’s Course Notes, Section 2.1 A, page 202.

(b) Test it building a histogram of the empirical probability density function fU(x) and a scatter plot in the (Ui − 1, Ui ) plane with the good parameters of page 203 and with the pathologic parameters of pages 208–209.

 

2. If X is a uniform random number on [ −π/2, π/2], what is the distribution of X = cos U? Find out

(a) analytically with the transformation formula (watch out because the cosine is not monotonic, so you distinguish between the interval where it increases and the interval where it decreases);

(b) numerically, sampling an appropriate quantity of uniform random numbers, taking their cosine, and building a histogram.

 

3. Starting from the linear congruential uniform random number generator that you wrote in Assignment 1.2, implement the Fibonacci generator described in Seydel’s Course Notes, Section 2.1 B, pages 211–212, and reproduce the scatter plot on page 213.

 

4. There are several methods to obtain standard normal random numbers starting from standard uniform random numbers. Which do you know? Implement the rejection method using the Laplace  (or double exponential) distribution as the majorant function, following the instructions on Seydel’s Course Notes, Section 2.1 C, pages 221–223.