Outline for January 23

Reading: none
Due: Homework 2, due on February 1 at 11:55pm


  1. Calculating π using a Monte Carlo method
    1. How you do it
    2. random module
    3. Building program in modules, including testing routines
    4. First step: computing co-ordinates of dart toss [mc1.py]
    5. Second step: see if a point falls within the unit circle [mc2.py]
    6. Third step: read in a positive integer, with error checking [mc3.py]
    7. Fourth step: out it all together and print the results [mc4.py]
    8. Fifth step: plot the points [mc5.py]
    9. Sixth step: add the results to the plot [mc6.py]


UC Davis seal
Matt Bishop
Office: 2209 Watershed Science
Phone: +1 (530) 752-8060
Email: mabishop@ucdavis.edu
You can also obtain a PDF version of this.
Version of January 23, 2019 at 10:11PM