Question: Q1 [50 points]. Let us design a Monte Carlo method to estimate the area of the shadow region under the green function y=ex when x
![Q1 [50 points]. Let us design a Monte Carlo method to](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3cca49d4a6_66866f3cca410fe0.jpg)
Q1 [50 points]. Let us design a Monte Carlo method to estimate the area of the shadow region under the green function y=ex when x is from 0 to r. As shown in the following figure, r is a variable (r>0) for range. Please write a Python program named "A1Q1_MonteCarlo.py" to implement your designed Monte Carlo method. In the first line of your code, please write " n=10000 " to define n as the experiment number of random sampling. Finally, please print out the estimated area for different range variables with the following format: When r=1, estimated shadow area is xxx When r=2, estimated shadow area is xxx When r=9, estimated shadow area is xXX When r=10, estimated shadow area is xxx [Hint]: You may need to use a loop for different range variables r and generate random sampling points automatically based on different range variables r
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
