Question: import numpy as npimport numpy.linalg as ladef steady _ state _ vector ( mat ) : dimension = mat.shape [ 0 ] # Store the

import numpy as npimport numpy.linalg as ladef steady_state_vector(mat): dimension = mat.shape[0] # Store the dimension of the matrix mat2= mat - np.eye(dimension) # mat2 is mat - Identity Matrix (I) ones = np.ones(dimension) mat2= np.c_[mat2, ones] X = np.dot(mat2, mat2.T) Y = np.ones(dimension) return la.solve(X, Y)def three_step_transition(mat, i, j): temp = mat # Initialize temp with mat^1 temp = np.dot(temp, mat) # Calculate temp^2 temp = np.dot(temp, mat) # Calculate temp^3 return temp[i][j]markov_matrix = np.array([[0.8,0.05,0.01,0.14],[0.1,0.4,0.1,0.4],[0.1,0.05,0.7,0.15],[0.1,0.05,0.1,0.75]])steady_state = steady_state_vector(markov_matrix)prob_stark = three_step_transition(markov_matrix, 0,1) # 0- House Targaryen, 1- House Stark# Print the resultsprint("Steady State Vector:")print(steady_state)print("Probability of Transition from House Targaryen to House Stark after 3 steps:")print(prob_stark)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!