CS 1025 01 - Week #9 - Oct 15, 17, 19


  1. Monte Carlo introduction. Link to the concept of Monte Carlo simulations and throwing fruit snacks or darts at a target to estimate an area.
    There are 3 sections on this web page MCintro.html
    Study the first two sections and skip/ignore the third section.
    
    Read em:
      1. Introduction to Monte Carlo Methods
      2. Monte Carlo Calculation of Pi
    
    Ignore it:
      3. Monte Carlo Computation of Population Distribution
    
  2. Another Monte Carlo resource - square with a circle inscribing the square. Estimating the area.
    "For example, consider a circle inscribed in a unit square. Given that the circle
    and the square have a ratio of areas that is ?/4, the value of ? can be approximated
    using a Monte Carlo method:[4]
    
        Draw a square on the ground, then inscribe a circle within it.
    
        Uniformly scatter some objects of uniform size (grains of rice or sand) over the square.
    
        Count the number of objects inside the circle and the total number of objects.
    
        The ratio of the two counts is an estimate of the ratio of the two areas, which
    is ?/4. Multiply the result by 4 to estimate ?.
    
    In this procedure the domain of inputs is the square that circumscribes our circle.
    We generate random inputs by scattering grains over the square then perform a
    computation on each input (test whether it falls within the circle). 
    Finally, we aggregate the results to obtain our final result, the approximation of ?."
    

    In class today, we threw bags of fruit snacks at targets down
    on the floor below us.
    
        Our domain of inputs was the 9 carpet square area with the colored large
    construction paper sheet within it and the sheet of paper taped inside 
    of that.
    
        We generated random inputs by throwing the fruit treat bag
    at the target area.  Too much skill at hitting the target would
    mean its NOT random.  But we were far enough away, plus the treats 
    bounced too.
    
         Count where each of the ten shots landed.
    
         Get the ratios.
    
  3. Homecoming Eve class: Excel and Monte Carlo.  
    
         The random numbers would be random x,y pairs, 
                         such as (0.5, 0.3) and
                                 (0.9, 0.8) and 
                                 (0.7, 0.7) and 
                                 (0.9, 0.9).
    
         How far is each of the above (x, y) points from the origin, 
                                                    from the point (0, 0)?
    
         Distance between point (x1, y1) and point (x2, y2) is:
    
         The square root of ( (x2 - y1) squared = (y2 - y1) squared )
    
         Since we have point (x1, y1) here as (0, 0), the origin,
    
         its just that much simpler:
    
         Distance from (0.9, 0.8) to the origin is:
    
            
            square root of ( (0.9 - 0) squared + (0.8 - 0) squared )
    
            square root of ( (0.9) squared + (0.8) squared )
    
    
             square root of ( 0.81 + 0.64 ) or
             square root of ( 1.45 )
    
                        =  1.204
    
         So the distance of that point (0.9, 0.8) 
                 from the origin point (0,   0  ) 
                                              is 1.204 
                 and it would be 
                    OUTSIDE of a circle of radius 1, 
                       for any circle having its center at (0, 0) and
                        having radius = 1 and diameter = 2.
    
  4. Monte Carlo examples using Excel.

  5. More Monte Carlo with f(x) and g(x) functions. What is the area between the two functions for the range of x values 1 through 20?