Question: bThis coding exercise is to perform a tiny simulation given a Markov chain transition matrix. Create a Python function named mc simulation that can simulate
bThis coding exercise is to perform a tiny simulation given a Markov chain transition matrix. Create a Python
function named mc simulation that can simulate a history sequence of states given any transition matrix. The specific requirements are as follows.
Two inputs: i A: a Markov chain transition matrix; ii t: the number of steps to simulate. You can
use the row indices n of matrix A as the set of states.
IE Probabilistic Operations Research
One output: a list of states H s s s st where si represents the state occurred at time i in
this simulation. You need to randomly pick an arbitrary state from S as the initial state s
Test instance: test your algorithm with inputs S and A being the state set and transition matrix of
Gamblers Ruin class example with p and use t as the number of simulation steps. Run
five times of your function, and check how is the simulated history of each run.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
