Presentation on theme: "Simulation Examples in EXCEL Montana Going Green 2010."— Presentation transcript:
Simulation Examples in EXCEL Montana Going Green 2010
Example 1 Flip of a fair coin
Algorithm Inputs: Number of trials (flips), N Output: P(H), P(T) Step 1: Set Counter H and T at 0. Step 2: For I = 1 to N (number of flips) do Step 3: Generate a random number, x i, between [0,1] Step 4: If 0 < x i <.5, then H=H+1, else T=T+1 Step 5: Calculate P(H) = H/N and P(T)=T/N Output P(H) and P(T) Stop
Go to EXCEL
Example 2 Area under a nonnegative curve such as y=x 3 from [0,2].
Lets go to EXCEL
Example 3 Buffon Needle Experiment In mathematics, Buffon's needle problem is a question first posed in the 18th century by Georges-Louis Leclerc, Comte de Buffon:mathematicsGeorges-Louis Leclerc, Comte de Buffon –Suppose we have a floor made of parallel strips of wood, each the same width, and we drop a needle onto the floor. What is the probability that the needle will lie across a line between two strips?floorparallelwoodneedle probability Buffon's needle was the earliest problem in geometric probability to be solved; it can be solved using integral geometry. The solution, in the case where the needle is not greater than the width of the strips, can be used to design a Monte Carlo method for approximating the number π.geometric probabilityintegral geometryMonte Carlo methodπ
Process If you allow the needle to be equal to the distance between parallel lines then Pi=2 * number of tosses/# crossing lines
Go to EXCEL
Fun Game Monty Hall Here is the typical scenario. Monty has the grand prize behind one of three doors. The contestant picks a different door. Monty choose the a different door (not yours and not the grand prize). Do you stay with your pick or switch to the other door? This question became a big discussion with in Parade Magazine.
The problem was originally posed in a letter by Steve Selvin to the American Statistician in A well-known statement of the problem was published in Marilyn vos Savant's "Ask Marilyn" column in Parade magazine in 1990:American StatisticianMarilyn vos SavantParade Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what's behind the doors, opens another door, say No. 3, which has a goat. He then says to you, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice? Whitaker/vos Savant 1990
Throughout the many years of Let's Make A Deal's popularity, mathematicians have been fascinated with the possibilities presented by the "Three Doors"... and a mathematical urban legend has developed surrounding "The Monty Hall Problem." The CBS drama series NUMB3RS featured the Monty Hall Problem in the final episode of its season. The show's mathematician offered his own, very definite solution to the problem involving hidden cars and goats. The 2008 movie 21 opens with an M.I.T. math professor (played by Kevin Spacey) using the Monty Hall Problem to explain mathematical theories to his students. His lecture also includes the popular "goats and cars behind three doors" example favored by many versions of the Problem
Lets go to EXCEL
Other problems Service with a smile: A small service department has one server. Customers arrive according to the distribution in Table 1. The server can handle the customers according to the distribution in Table 2. You want to use a simulation to estimate the busy time of the server, the average length of the queue, the average waiting time of customers, and the average number of customers present. Use a simulation with one hundred events.