Starting from:

$25

CSC632-Exam 1 Solved


Introduction to Simulation and Modeling, CSC 432/632 

Question 1 
 
Use online, library and other resources to answer the following questions. You can use Internet references, library resources, your prior knowledge, and any other resource. For each question, provide references that you used.

Provide two applications in computer science for each of the following methodologies.  

a)        Monte Carlo Simulation.  

b)        Markov Decision Process

c)        Random Walks  

d)        Resampling method    

Question 2 (4 points)  
 
A gambler has the chance to enter a gamble using a fair coin. The gambler needs to invest $100 to enter the game. If the coin is tossed a head (p = 0.5), the gambler wins one dollar otherwise losses one dollar. The game stops after N=100 trials (100 times tossing the coin).  

a)      Model this problem and run a simulation model to determine if the gambler is better off getting into this game. Repeat the simulation when the number of trials N = 1000.  

b)      If the dealer uses an unfair coin (p = 0.49), does the gambler enters the game using N=100? Repeat the game when the number of trails N =1000.      

Now, the gambler is given a chance to exit the game only if the remaining dollar in the middle of the game is $100 (for example the gambler can exit when 25 tosses left and he owns $100). Let us call this situation State100.  

c)      Model this problem and run a simulation model to estimate the number of times the gambler can exit the game, when N= 100 and N=1000.  

d)      Is there any difference between different State100s? For example, do you see the gambler makes different decision when there are 20 tossing coin left compared with 2 tossing coin left.  

Question 3 (5                
We want to simulate a dollar slot machine that has three reels (spinning cylinders).  To play the game, we first insert $1 and pull the handle.  All three reels then spin independently, and each reel will stop randomly on one of the five pictures it contains.  Once the reels stop, we examine the three pictures and determine our winnings.  If we have exactly 2 cherries, we win $1 (so we break even).  If we have 3 bells, we win $2.  If we have 3 cherries, we win $3.  For all other outcomes, we win nothing.  The composition of each reel is summarized below.

# of Pictures on Each Reel 
Picture 
Reel 1 
Reel 2 
Reel 3 
Lemon
2
3
2
Bell
1
1
2
Cherry
2
1
1
 
a.       Provide details for a strategy to determine what picture each reel stops on, given a U (0,1) number. Detailed strategy means that you need to divide the uniform variable range U(0,1) into sub-intervals and assign pictures. For example, if the random variable is between 0 and x (x is between 0 and 1) then it is a cherry, etc.  

b.      Complete the following table to simulate 5 replications of this system.  What is the average profit over these five games?

U(0,1) Numbe

Picture Shown on Each Reel 
Winnings 
Net Profit 
Reel 1 
Reel 2 
Reel 3 
Reel 1 
Reel 2 
Reel 3 
0.31 
0.57 
0.97 

0.61 
0.23 
0.89 

0.38 
0.55 
0.42 

0.46 
0.71 
0.52 

0.91 
0.75 
0.19 

c.       Assume that the gambler starts with $100. Write a Python code to determine the expected value of the player after 50 rounds of the game.     

Question 4 (5                
1.5

Consider the integral I = ò 1 e(-x2 / 2)dx .  

 1 2p

a.       What distribution function this probability distribution function represents? Use Normal distribution table to determine the “exact” value of I?   (Show your work to receive credit.  I’m not testing whether your calculator can integrate this numerically!)


b.      Evaluate I using Monte Carlo integration using a Python code and U(0,1) random numbers.  

(Provide the details of the Python code.)

Question 5 (4                
 

Using the Gradient Descent algorithm and the Newton-Raphson method in Python to calculate the maximum/minimum value of  

 

𝑦=3𝑥%−5𝑥+2

 

Use Python codes to determine the possible local maximum/minimum of this function.

More products