Question: Let us design a Monte Carlo method to estimate the area of the shadow region under the green function y = e* when x
Let us design a Monte Carlo method to estimate the area of the shadow region under the green function y = e* 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 "A101 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 xxxx 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 rand generate random sampling
Step by Step Solution
3.47 Rating (163 Votes )
There are 3 Steps involved in it
Step 1 Algorithm Import therandomandmathmodules Set t... View full answer
Get step-by-step solutions from verified subject matter experts
