Final answer:
To estimate the integral using Monte Carlo integration and uniform random numbers, generate random numbers and calculate the function values. Repeat this process multiple times, calculate the standard deviation, and plot histograms to visualize the estimates. Check if the true value lies within the range.
Step-by-step explanation:
To estimate the integral I = integrate (sqrt(sin x))/x dx from 0 to 1 using Monte Carlo integration and uniform random numbers:
- Generate 10^6 uniform random numbers between 0 and 1.
- Calculate the function value sqrt(sin x)/x for each random number.
- Estimate I by taking the average of the function values.
- Repeat steps 1-3 for 50000 times to obtain 50000 different estimates of I.
- Calculate the standard deviation σ of the 50000 estimates of I.
- Plot histograms of the estimates of I for the two types of random numbers.
- Draw two grey vertical lines at x = mu - sigma_overline_x and x = mu + sigma_overline_x, where mu is the average of the estimates of I and sigma_overline_x = sigma / sqrt(100).
- Draw a vertical red line to indicate the accurate solution obtained using scipy.integrate.quad.
From the histogram, check whether the true value lies between x = mu - sigma_overline_x and x = mu + sigma_overline_x.