{"metadata": {"signature": "sha256:a91d7ef4f30ab638771a3490b2aff1349cba064669317256b6697a235e612d35", "name": ""}, "nbformat_minor": 0, "worksheets": [{"metadata": {}, "cells": [{"cell_type": "markdown", "metadata": {}, "source": ["# Finding an equilibrium distribution using the power method"]}, {"cell_type": "code", "outputs": [], "collapsed": false, "metadata": {}, "language": "python", "input": ["import numpy as np"], "prompt_number": 2}, {"cell_type": "code", "outputs": [], "collapsed": false, "metadata": {}, "language": "python", "input": ["A = np.array([\n", " [.8, .6, .8],\n", " [.2, .3, 0],\n", " [0, .1, .2]\n", "])"], "prompt_number": 3}, {"cell_type": "markdown", "metadata": {}, "source": ["Now find a starting `x`:"]}, {"cell_type": "code", "outputs": [], "collapsed": false, "metadata": {}, "language": "python", "input": ["x = np.random.randn(3)"], "prompt_number": 6}, {"cell_type": "markdown", "metadata": {}, "source": ["Next, compute $A^{100}x$:"]}, {"cell_type": "code", "outputs": [{"prompt_number": 25, "metadata": {}, "output_type": "pyout", "text": ["array([ 0.84960372, 0.24274392, 0.03034299])"]}], "collapsed": false, "metadata": {}, "language": "python", "input": ["x = A.dot(x)\n", "x"], "prompt_number": 25}, {"cell_type": "markdown", "metadata": {}, "source": ["What does this mean?"]}]}], "nbformat": 3}