Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
We can use this method to estimate the area of the region E under the curve y = x2 in the unit square. We choose a large number of points (x, y) at random and record what fraction of them fall in the region E = {(x, y): y x2}. Consider the program Monte-Carlo in Basic and the appropriate function in Mathcad that will carry out this experiment for you. Running this program for 10,000 experiments gives some estimate, say, 0.325. So, we would estimate the area to be about 1/3. Of course, for this simple region we can find the exact area using integration methods known from your Calculus course. In
2 fact, area of E = x dx = 1/3. 0 1
Do the following exercises first in Mathcad, then using Basic (or C++). Exercise 2.1 Alter the program MonteCarlo to estimate the area of the circle of radius 1/2 with center at (1/2,1/2) inside the unit square by choosing 1000 points at random. Compare your results with the true value of /4. Use your results to estimate the value of . How accurate is your estimate? Exercise 2.2 Alter the program MonteCarlo to estimate the area under the graph of y = sin(x) inside the unit square by choosing 10,000 points at random. Now calculate the true value of this area and use your results to estimate the value of . How accurate is your estimate? Exercise 2.3 Alter the program MonteCarlo to estimate the area under the graph of y = 1/(x + 1) in the unit square. Calculate the true value of this area and use your simulation results to estimate the value of log2. How accurate is your estimate?
Execution order
1. Find the archive or folder on X:\BRIGADES\Br1\LabProb 2. Copy it to your work disk, say C:\temp\ the local network disk suppose,
In any case, dont work from any remote disk that is different from C:\ or D:\ The local-net drives are to store and copy not for work.
3. 4. 5. 6. 7. 8. 9. UnRAR all archives(if any) in the given directory (folder). Read the remarks. Run and read the MathCAD file LabProb3.mcd Perform Task 1 with that file. Perform Task 2 with MathCAD. Perform Task 2 with BASIC or C++. To make BASIC program work click bas3lab.bat Then F5 to run. Answer questions and see results. Press ENTER to return and make more experiments for different functions, as given in Exercises 2.12.3 10. ALT ENTER X for getting out of BASIC. 11. Make conclusions about the method write a report-file.