Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code this problem in python [ : Assignment Suppose that a person does random walk on 5 states: S = [0, 1, 2, 3, 4].

Code this problem in python

image text in transcribed
[ : Assignment Suppose that a person does random walk on 5 states: S = [0, 1, 2, 3, 4]. Also, suppose that state 0 and state 4 are terminal (absorbing) states. That is, once the person reaches state 0 or state 4, he/she will stop. In particular, for any non-terminal states (state 1, 2, and 3), this person has euqal probability of going left or going right. Problem: What is the probability of ending at state 0, given this person starts at state i = 0, 1, , 5? Output: your output should be a list or an array, with the i-th element indicating the probability of ending at state 0, starting from state i. For example, [1, 0.1, 0.2, 0.3, 0] indicates that starting from state 1, this person has 10% probability of ending at state 0; starting from state 2, this person has 20% probability of ending at state 0; starting from state 3, this person has 30% probability of ending at state 0. Hint: If starting from state 0, then the probability of ending at state 0 is 1. If starting from state 4, then the probability of ending at state 0 is 0 (since state 4 is a terminal state itself). As a result, the output list should look like [1, x, y, z, 0], where x, y, and z are the probabilities you need to find out

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions