Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Develop a Monte Carlo simulation by writing an algorithm that generates a seq

ID: 3838245 • Letter: 1

Question

1. Develop a Monte Carlo simulation by writing an algorithm that generates a sequence of uniform random numbers (01 for values ofxand yon the OABC region, and calculate the corresponding z distance. Compute the integrated values for T Tshot. and simulated values of T. Using matlab. hit 2. Generate a2-dimensional plot of y shot values for simulation trials of n 10, 100, and 1000. This is essentially reproducing the OABc region with shot values as in the first figure. 3. Generate a 2-dimensional plot of your simulated value as a function of trials for 100000 trials Restrict the y-axis range from 3 to 33. This should resemble the second figure. 3. Determine how many trials are necessary in order to obtain an estimate of that is accurate to 34, and Expert Answer Hang tight! We are finding a Chegg Expert to answer this question. MacBook Air

Explanation / Answer

Following python code should give the results. One run of this gives following :

49974148 trials for 3 digit accuracy, 49989999 trials for 4 digit accuracy, 49997936 trials for 5 digit accuracy

Results may vary, increase total_is if it doesn't give results. Also, important thing to note is that, once 3 digit accuracy is achieved, 4 and 5 digit accuracy is also achieved sooner

import random
import math

count_inside = 0
total_is = 60000000;
check_3 = True;
check_4 = True;
for count in range(0, total_is+1):
    d = math.hypot(random.random(), random.random())
    if d < 1:
       count_inside += 1
    value = (4.0*count_inside)/total_is;
    if check_3 and (int(value*100) == 314): #accurate upto 3 digits
       print(count+1,' trials for 3 digit accuracy ');
       check_3 = False;
    if check_4 and (int(value*1000) == 3141): #accurate upto 4 digits
       print(count+1,' trials for 4 digit accuracy ');
       check_4 = False;
    if int(value*10000) == 31415: #accurate upto 5 digits
       print(count+1,' trials for 5 digit accuracy ');
       break;