#! /usr/bin/env python3 # def cows ( ): #*****************************************************************************80 # ## cows() does a simply power method analysis for the cow problem. # import numpy as np T = np.array ( [ \ [ 0, 0, 0.5, 1 ], \ [ 1, 0, 0, 0 ], \ [ 0, 1, 0, 0 ], \ [ 0, 0, 0.5, 0 ] ] ) for it in range ( 0, 61 ): if ( it == 0 ): x = np.array ( [ 98, 0, 0, 0 ] ) else: x = np.dot ( T, x ) print ( x ) return if ( __name__ == "__main__" ): cows ( )