0% found this document useful (0 votes)
35 views2 pages

Monte Carlo Endsem Report

Aryan Rathee's lab report discusses generating Brownian motion sample paths using the Euler-Maruyama method. 5000 points are generated over a 1 second interval. The values are stored in arrays and plotted on a graph, showing random motions ranging from -1.5 to 1.5. Confidence intervals are also calculated for random variables using the sample mean and variance. Importance sampling is used to improve the interval estimates by restricting the sample space. This decreases the variance, allowing a smaller confidence interval. Monte Carlo integration is also used to calculate the expectation of a function.

Uploaded by

Pradeep Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views2 pages

Monte Carlo Endsem Report

Aryan Rathee's lab report discusses generating Brownian motion sample paths using the Euler-Maruyama method. 5000 points are generated over a 1 second interval. The values are stored in arrays and plotted on a graph, showing random motions ranging from -1.5 to 1.5. Confidence intervals are also calculated for random variables using the sample mean and variance. Importance sampling is used to improve the interval estimates by restricting the sample space. This decreases the variance, allowing a smaller confidence interval. Monte Carlo integration is also used to calculate the expectation of a function.

Uploaded by

Pradeep Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Aryan Rathee

190123013
MA323 Endsem Lab Report

1.

The above formula is used to compute the sample paths of the all the browian motions where W(t(i)) is the value of the
Brownian path at time t(i). The interval is [0,1] i.e. 1 sec and we have to generate 5000 points of the path so for that purpose
we take the points at time interval 1/5000. Also, it is given that W(0) is 0 and after that we use the previous value generated to
generate the next value of the Brownian path. The Z(i) are random variable with standard normal distribution, N(0,1) i.e. with
mean 0 and standard deviation 1, which are calculated using Box-Muller method.

When it comes for plotting graph, for that I first generate all values and store them in a 2D array, also I make another array for
the time intervals, then I plot all the graphs using matplot library in python, all one by one on the same graph, then I display
the graph which shows a completely random motion of paths whose final values range all the way from -1.5 to 1.5 all starting
from 0.

2.
a. First random variables are generated using Box-Muller method which have standard normal distribution, then I checked if
they are greater than 4 or not, if yes then I append 1 in the array other wise 0, after the computation of random variables is
complete, then the probability of X>4 will be equal to the expectation(mean) of the numbers and then variance is calculated
using the above formula and for 99% confidence interval, we use the above formula, for that we need mean, variance and
n(no. of sample points), all of which we have. The confidence interval obtained is shown in the above figure.

b. Here the importance distribution is taken as q=e^(-x+4), whenever x>4 and whenever x is less than 4, then q is 0, the
corresponding CDF is 1-e^(-x+4) and for generating the random number with this distribution we have to find its inverse and
then use it, which comes out to be 4-log(1-u) which has the same distribution as 4-log(u) where u has uniform distribution in
(0,1). This pdf is chosen because it is 0 when x<=4 and hence generates only the values of x greater than 4 and so decreases
the space of our search where it is almost certain that we are not going to get our desired value. The likelihood ratio, p(x)/q(x)
comes out to e^(-x*x/2+x-4)/sqrt(2*pi) which is used to generate the sampling and the distribution of x is that of q. In this case
also the confidence interval is then calculated in the same way and the obtained value is denoted in the above figure.

c. The variance in part b is drastically decreased from part a, almost by a factor of 10^(-4), this is because we are now
considering less points which are not of out use, now we consider those points which increase our sample space, also this
increase in sqrt(variance) is directly related to the confidence interval and so we get a smaller confidence interval in the part b
which is good thing.

3.

In this question first we will integrate the function w.r.t y with the limits -infinity to +infinity and then it will become single
variable function, then we use standard monte carlo technique to generate random points and calculate expectation.

The function comes out to be (9/8)*log(1+x)*exp((-3/2)*x).

You might also like