Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Maths for transforming time series data of walking into a linear least squares form: Ax=b that can solve for the gains.
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This notebook describes the details of forming the coefficient matrix and ordinate vector from walking data for a linear least squares solution to the optimal gains from a simple full state feedback controller employed by the human while walking."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"!pip freeze"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Cython==0.19.1\r\n",
"-e git+git@github.com:moorepants/DynamicistToolKit.git@83822a2634756ad8a0a1701a0cb3cca3c07877d4#egg=DynamicistToolKit-dev\r\n",
"Jinja2==2.7.1\r\n",
"MarkupSafe==0.18\r\n",
"argparse==1.2.1\r\n",
"coverage==3.6\r\n",
"ipython==1.0.0\r\n",
"matplotlib==1.3.0\r\n",
"nose==1.3.0\r\n",
"numpy==1.7.1\r\n",
"pandas==0.12.0\r\n",
"pyparsing==2.0.1\r\n",
"python-dateutil==2.1\r\n",
"pytz==2013b\r\n",
"pyzmq==13.1.0\r\n",
"scipy==0.12.0\r\n",
"six==1.3.0\r\n",
"sympy==0.7.3\r\n",
"tornado==3.1\r\n",
"wsgiref==0.1.2\r\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from sympy import init_printing\n",
"init_printing()"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 2
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from sympy import symbols, Matrix, Symbol, zeros, eye"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 3
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"n = 3 # number of time samples in each cycle (step)\n",
"m = 2 # number of cycles (steps)\n",
"p = 2 # number of sensors\n",
"q = 2 # number of controls"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 4
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First form the equation that generates the controls given the error in the sensors at a single time step during a single foot step.\n",
"\n",
"$$m_m(t) = m(t)_{lc} + K(t) s_e(t) = m(t)_{lc} + K(t) (s_{lc}(t) - s_m(t))$$\n",
"\n",
"Now rearrange the equations such that we have one linear in both the gains, $K(t)$, and in $m^*(t)$:\n",
"\n",
"$$m_m(t) = m(t)_{lc} + K(t) s_{lc}(t) - K(t) s_m(t) = m^*(t) - K(t) s_m(t)$$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The \"measured\" controls, $m_m(t)$:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"mm = Matrix(q, 1, lambda i, j: Symbol('m_m_q={}'.format(i)))\n",
"mm"
],
"language": "python",
"metadata": {},
"outputs": [
{
"latex": [
"$$\\left[\\begin{smallmatrix}{}m_{m q=0}\\\\m_{m q=1}\\end{smallmatrix}\\right]$$"
],
"metadata": {},
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAEYAAAAZBAMAAAB+2EWVAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAu90iZpkydkTvqxCJ\nVM1ghewcAAABHElEQVQoFWMQUjJgYAlJL2UvTGDABjiUdBgUgBIs/Q6cq9kXoCvhPnIaJGQFVmNd\nxMDfwHoAXQ3jho0INQzLGTIZmC6gq+Fn4NwAFIOYwzCNoZDBno3B9Ypr7zEGBvcag1OrVq26YMnA\nlABXw/wBaJIjD8P1B5wX7jDwBnBCTERRw7GA4TGD1WkGroRNDGcZ+BISIWpQ7YKIMTAxXGVQuMC0\n4TgD2C5UN0PV7GKoYFhuwHFEDcLnDjkMYkDdDFUDoybAGGAaqxrWv4TVoKjAZReqIohd+OIUZg6O\nOGXgAkUF/jjlOGmAUIMjThmYkNVgj1MUNTjiFEUNjjhFUQMLD7Q4xaoGLU7Z6mOR/AUzCEqTE6dK\nwPyFD3AoaQEAe8NjjECjxxQAAAAASUVORK5CYII=\n",
"prompt_number": 5,
"text": [
"\u23a1m_m_q=0\u23a4\n",
"\u23a2 \u23a5\n",
"\u23a3m_m_q=1\u23a6"
]
}
],
"prompt_number": 5
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The unknown gains, $K$:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"K = Matrix(q, p, lambda i, j: Symbol('k_q={},p={}'.format(i, j)))\n",
"K"
],
"language": "python",
"metadata": {},
"outputs": [
{
"latex": [
"$$\\left[\\begin{smallmatrix}{}k_{q=0,p=0} & k_{q=0,p=1}\\\\k_{q=1,p=0} & k_{q=1,p=1}\\end{smallmatrix}\\right]$$"
],
"metadata": {},
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAJoAAAAmBAMAAADO2Z8qAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEO+Zu3ZEIondMqvN\nZlSyKd/8AAACQUlEQVRIDe2UP2gTURzHvxfT5PKapKE66NRLRXQshS6CbYR2cZAiKRSlWJdat+Ag\ndDK2SAdJaaF/wOkodhAcdHAKiJsgCAUR4iIHorOhu3jv/X53757EvGAjOPSGy+/P933yfu8lXwyP\nnkd/nvHRMob7g1IUpg1csjNv1K2aaG+7ViVyi1YN05y2VYmRklXDtMymVYl7dgnT3LGDlzbxmrhl\nkzAt/+WOntVpPDKWnW2pGT98T8zKtVj3SkVMG7oc14F06UwiA646FZkf+fLND9eidPmiipi2Xw2i\nBjCElHHgP1AOm+LCdS0B1XRhT4VMqwrPx6f52pNmsxncR84HChOtwA3TN1kPT0PtQGVfoDC3nqx9\nXNiAWgKDNiM268WxFH0X0YrzDl0009Kzz118hac0XPtWP0dLTNo7vPbz/jNq8aTXxFvKaap8bfAm\n3otKspb2X1Bq0mQtV3pM25a3IADPPVRTRbcgNVvurK75SKHRaVKpzDTk8YSPc2UdD0vZnQVKcbpV\n4wjLn30Kw1q2jZW5Q0oPjgIZ8C1QzaMP+S6iUNeZjvhoVSFASzdUlKSd+qmbRaxUdKajqUDHQXZb\nJypK0n5r/UX6T2gnbpm8if/CLTFoGBI6uSXIHuO9/9ktM6vxP0mpO7kl22NE6+KWyJm0Tm7JphHR\nTA8x3JJoXd0StLwXtyRaV7dkWi9uyZN2dUvaWy9uKWk2t5S03txS3J60umVojyduGf8GjxuUMTI9\nc1wIr69Ot5FZutsn2oOlxV/mf9/t7EoKewAAAABJRU5ErkJggg==\n",
"prompt_number": 6,
"text": [
"\u23a1k_q=0,p=0 k_q=0,p=1\u23a4\n",
"\u23a2 \u23a5\n",
"\u23a3k_q=1,p=0 k_q=1,p=1\u23a6"
]
}
],
"prompt_number": 6
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The unknown \"limit cycle\" controls, $m^*(t)$:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"ms = Matrix(q, 1, lambda i, j: Symbol('m^*_q={}'.format(i)))\n",
"ms"
],
"language": "python",
"metadata": {},
"outputs": [
{
"latex": [
"$$\\left[\\begin{smallmatrix}{}m^{*}_{q=0}\\\\m^{*}_{q=1}\\end{smallmatrix}\\right]$$"
],
"metadata": {},
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAADwAAAAnBAMAAAChwzYZAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEO+Zu3ZEImYyq92J\nVM0hoUD5AAABRElEQVQ4EWNgQAYcAsg8EFtISRkuxHs0C84GMoyUFBmEkAVuL0fmMTCgSrOl1qCa\njirNwIaqGaa7uTPUINQTTQ7Ihepu+8GgJRCFS5pddAPDNwYbXNIMXAGcCgx7EdKMJw6COVDDmSaw\nOrB/mACXZxEQQZauB+rncDgAl+ZnYAL7EKo7i4GvgH2NAENrTMGpVatWXShi4AYbhepvXgMmiAHY\npfkmTIFIoxkOtZRb4CgD2HA0p0Gl2U7shLAYLY6DGah2MzAoQBVCKTRp5r94pVEl4VGCLgzjoxkO\nE4bRaNLoSRFVGi0pYthNXlKEpTUcSZG6aY2BC5IdoB5DT2tshwrAIQOVRk9rDNwo0uhpDU0aGsbw\ntIZdGp7WsEvD0xp2aXha44y3RXY5LH4x05q8iytckgE1rYW4fGRgS0tHSKOyytISAPZgUwRC8z7J\nAAAAAElFTkSuQmCC\n",
"prompt_number": 7,
"text": [
"\u23a1m^*_q=0\u23a4\n",
"\u23a2 \u23a5\n",
"\u23a3m^*_q=1\u23a6"
]
}
],
"prompt_number": 7
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The measured sensors, $s_m(t)$:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"sm = Matrix(p, 1, lambda i, j: Symbol('s_m_p={}'.format(i)))\n",
"sm"
],
"language": "python",
"metadata": {},
"outputs": [
{
"latex": [
"$$\\left[\\begin{smallmatrix}{}s_{m p=0}\\\\s_{m p=1}\\end{smallmatrix}\\right]$$"
],
"metadata": {},
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAEAAAAAZBAMAAABzxjXSAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAu90iiXZUmUQyEKtm\nze+zsTonAAABBUlEQVQoFWMQUjJgYGAJTWDABjiUVBgUQBIVnALo8lw+XiAha4gCwawF6AoYFyxE\nUjD7/wR0BfwMfCBNEBPYDLgDeMrOVKRMYDge48bgvXv37gQ7BiaQJogCpgnsE9hiGZ6xOTCkOiyC\nmIWigCcmgoFhJ5cCSwID44S5EAUoVoCFFNgKmNgY+Bh8IFagOhKogmsDawN3MINR6AGICVw1ziAG\n1JsQMRB5BMEEs9AVMCsSUIAmjcUKdBVQK3BFFtwELJHFwL0AZBrUBCyRxeEHTAZwBVgii4EJSQG2\nyEJRgC2yUBRgiywUBSDXMKBFFoYC9MjijC8DaUOPC3IiSwmUL3ABDiVtAAJzSZ85FRodAAAAAElF\nTkSuQmCC\n",
"prompt_number": 8,
"text": [
"\u23a1s_m_p=0\u23a4\n",
"\u23a2 \u23a5\n",
"\u23a3s_m_p=1\u23a6"
]
}
],
"prompt_number": 8
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"And the equation:\n",
"\n",
"$$0 = m(t) - m^*(t) + K(t) s(t)$$"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"zero = mm - ms + K * sm\n",
"zero"
],
"language": "python",
"metadata": {},
"outputs": [
{
"latex": [
"$$\\left[\\begin{smallmatrix}{}k_{q=0,p=0} s_{m p=0} + k_{q=0,p=1} s_{m p=1} - m^{*}_{q=0} + m_{m q=0}\\\\k_{q=1,p=0} s_{m p=0} + k_{q=1,p=1} s_{m p=1} - m^{*}_{q=1} + m_{m q=1}\\end{smallmatrix}\\right]$$"
],
"metadata": {},
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAAnBAMAAAAGFxWOAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEO+Zu3ZEIondMqvN\nZlSyKd/8AAAEwklEQVRYCe1YS4gcVRQ9/e+unq6UUcHgIu2IKCjSG4MEjBWYbLKIg6RjUEfbhWMk\nII0rs0qrDAFlQgtqYBZShGQhuoiLQXFEgxtBOjAwjIyCUiLRuBASAi4EP+//blVXZ7q6R6cV36Lq\nvnvPvffUe6+aOg1MzKh5qansnL4TKNyTOo8mPNqhsxFtd+F4mszc9LSHnSLj7TR5FFvkk0qLuka1\nf/4wkrlpzawin7kWyUsxyXPs7vQb3t+i+OxLkTJ+PyTq0eSL3ah/+Jkg//zw+BsgxSbauG/NZEuT\nLzfOX0hGK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mWNv0HDKoKafETD6i9w/QApNWz8Q519z6fTsHxhb6hhFUFNPqJhZWxUDav03RgaVi2szxYvWcPG\nyEc0rIwZtZlSwyryY2hYxY2TT9awMfIRDatiRm2m1LDy2IyhYQn5ZA0bI88e0ioZHhtDw3LywTga\nlpDnvPiQ8llr2ATyRslw1TmGhmXidDwNq7gN1rBKFusXVj5fXd74dTs1rCJvyRjrX6Bh9f8NhrMx\n/lsadvfMAfNk22uk07CFmUc8FOef217OI3Yvzc/jL9lTJETMjCn1AAAAAElFTkSuQmCC\n",
"prompt_number": 9,
"text": [
"\u23a1k_q=0,p=0\u22c5s_m_p=0 + k_q=0,p=1\u22c5s_m_p=1 - m^*_q=0 + m_m_q=0\u23a4\n",
"\u23a2 \u23a5\n",
"\u23a3k_q=1,p=0\u22c5s_m_p=0 + k_q=1,p=1\u22c5s_m_p=1 - m^*_q=1 + m_m_q=1\u23a6"
]
}
],
"prompt_number": 9
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now for a simple linear least squares the equations can be massage into this form:\n",
"\n",
"$$Ax=b$$\n",
"\n",
"which gives and over determined system of linear equations.\n",
"\n",
"We define $x$ as:\n"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"x = K.reshape(q * p, 1).col_join(ms)\n",
"x"
],
"language": "python",
"metadata": {},
"outputs": [
{
"latex": [
"$$\\left[\\begin{smallmatrix}{}k_{q=0,p=0}\\\\k_{q=0,p=1}\\\\k_{q=1,p=0}\\\\k_{q=1,p=1}\\\\m^{*}_{q=0}\\\\m^{*}_{q=1}\\end{smallmatrix}\\right]$$"
],
"metadata": {},
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAFgAAABsCAMAAADZoIW9AAAANlBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABHL6OuAAAAEXRSTlMAMquZdlQQ\nQN0iRO+JzWa7fNDgyowAAAOnSURBVGgF7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mfYTGOixyYEeJRyALHvODb4BAgVpdlcQwSqv8zwB+fd9ybj8/7HT4v9GCc\ndckH5M7nsZjxZJr/KfCtz2Mx42Mw93lk4F6Iv7KnLOYg7kyxvQrYc6YPwM5PTbiZV9l3phGL7U9N\nBv3TECHu3iV9ZxoBm5+aCHw9e5h8Z8pixoecULcMZxoaHq3LcaYI+QUUbjPuTbLH3gAAAABJRU5E\nrkJggg==\n",
"prompt_number": 10,
"text": [
"\u23a1k_q=0,p=0\u23a4\n",
"\u23a2 \u23a5\n",
"\u23a2k_q=0,p=1\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2k_q=1,p=0\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2k_q=1,p=1\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2 m^*_q=0 \u23a5\n",
"\u23a2 \u23a5\n",
"\u23a3 m^*_q=1 \u23a6"
]
}
],
"prompt_number": 10
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To form the A matrix for a single time step in a single foot step the equation can be rearranged:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"A = zeros(q, q * p)\n",
"for row in range(q):\n",
" A[row, row * p:(row + 1) * p] = sm.T\n",
"A = A.row_join(-eye(q))\n",
"A"
],
"language": "python",
"metadata": {},
"outputs": [
{
"latex": [
"$$\\left[\\begin{smallmatrix}{}s_{m p=0} & s_{m p=1} & 0 & 0 & -1 & 0\\\\0 & 0 & s_{m p=0} & s_{m p=1} & 0 & -1\\end{smallmatrix}\\right]$$"
],
"metadata": {},
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAARYAAAAmBAMAAADzbqllAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEO+Zu3ZEIolUMqvd\nZs0eYxJ8AAADf0lEQVRYCc2WzWvUQBjGn2w/dpPN0rV6ECz0Q0R6q4LF+gEtrAc9FbS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8oimB7j9F22k1DBq58OK2nGrbIEsnrT\no6/IQMmw6E2PvrJdLLLuZjLJ3JfN7Cz37C6W9sIZGXEHMhcKNTSPXd2BneUtb40V/wH69wfWJ8Iq\nCQAAAABJRU5ErkJggg==\n",
"prompt_number": 11,
"text": [
"\u23a1s_m_p=0 s_m_p=1 0 0 -1 0 \u23a4\n",
"\u23a2 \u23a5\n",
"\u23a3 0 0 s_m_p=0 s_m_p=1 0 -1\u23a6"
]
}
],
"prompt_number": 11
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"b = -mm\n",
"b"
],
"language": "python",
"metadata": {},
"outputs": [
{
"latex": [
"$$\\left[\\begin{smallmatrix}{}- m_{m q=0}\\\\- m_{m q=1}\\end{smallmatrix}\\right]$$"
],
"metadata": {},
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAFUAAAAmBAMAAABHbcoGAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEO+Zu3ZEIlRmMqvd\nic1EIzl8AAABPklEQVQ4EWMQUlJmIAIwKykJMAgRoRCshGlIq+W0XBrMGrIAh2dR/caZP4FpI+sG\ndLWMNy+ChFDVFsYw8CcwX0BXyyIggqy2xQUIBBi2Mixi4GlAV8sPMhLdXAYthhCGei6GyZ2TM24x\nMEyNLbi9e/fuhiIGngUYatk/AE2ewsvQ+oCpoZeBw4AJYgNWtWwbGJ4zVF9k4F4gw3CDgW/BEoha\n7G6AyDHwMDQzHGjgEbjKAHYDmt+giqCUNEMYw9YCtpunIHxGy+sgBmqYQZXCKQU4C8TAq5b5B/Fq\nUVQSMHfQq6VC+mXgBiUztPDFkX7ZLhUgq8Wbfhl4UNRCgxJ7+sWqFkf6xaoWR/rFqhbqEvT0i1ct\nWvrlirdADgeYiai0Agp3CKZfeRdXFC/g4LC6+AswsKWl45BGEWZPS2MAANK2Y7+yx1MrAAAAAElF\nTkSuQmCC\n",
"prompt_number": 12,
"text": [
"\u23a1-m_m_q=0\u23a4\n",
"\u23a2 \u23a5\n",
"\u23a3-m_m_q=1\u23a6"
]
}
],
"prompt_number": 12
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we can check to make sure that our new form gives the same answer as the previous form:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"zero2 = A * x - b \n",
"zero2"
],
"language": "python",
"metadata": {},
"outputs": [
{
"latex": [
"$$\\left[\\begin{smallmatrix}{}k_{q=0,p=0} s_{m p=0} + k_{q=0,p=1} s_{m p=1} - m^{*}_{q=0} + m_{m q=0}\\\\k_{q=1,p=0} s_{m p=0} + k_{q=1,p=1} s_{m p=1} - m^{*}_{q=1} + m_{m q=1}\\end{smallmatrix}\\right]$$"
],
"metadata": {},
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAAnBAMAAAAGFxWOAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEO+Zu3ZEIondMqvN\nZlSyKd/8AAAEwklEQVRYCe1YS4gcVRQ9/e+unq6UUcHgIu2IKCjSG4MEjBWYbLKIg6RjUEfbhWMk\nII0rs0qrDAFlQgtqYBZShGQhuoiLQXFEgxtBOjAwjIyCUiLRuBASAi4EP+//blVXZ7q6R6cV36Lq\nvnvPvffUe6+aOg1MzKh5qansnL4TKNyTOo8mPNqhsxFtd+F4mszc9LSHnSLj7TR5FFvkk0qLuka1\nf/4wkrlpzawin7kWyUsxyXPs7vQb3t+i+OxLkTJ+PyTq0eSL3ah/+Jkg//zw+BsgxSbauG/NZEuT\nLzfOX0hGKG+5GSbHBflXnSeSo9q78JS2Eu5r3zQbzYN9AZ95BoQkVpOf+u4Ze3Ayiy9HKt224WGP\nw2tFhoQJ8pd+JAeHw+moesi1zlGPtD/Qrq9+x71e/9P7LJ4cUgQ1+R17dSV2z3u3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htDw3LywTga\nlpDnvPiQ8llr2ATyRslw1TmGhmXidDwNq7gN1rBKFusXVj5fXd74dTs1rCJvyRjrX6Bh9f8NhrMx\n/lsadvfMAfNk22uk07CFmUc8FOef217OI3Yvzc/jL9lTJETMjCn1AAAAAElFTkSuQmCC\n",
"prompt_number": 13,
"text": [
"\u23a1k_q=0,p=0\u22c5s_m_p=0 + k_q=0,p=1\u22c5s_m_p=1 - m^*_q=0 + m_m_q=0\u23a4\n",
"\u23a2 \u23a5\n",
"\u23a3k_q=1,p=0\u22c5s_m_p=0 + k_q=1,p=1\u22c5s_m_p=1 - m^*_q=1 + m_m_q=1\u23a6"
]
}
],
"prompt_number": 13
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"assert zero == zero2"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 14
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now for n timesteps we want to form the A matrix such that there are different gains for each time step."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"gain_matrices = []\n",
"control_vectors = []\n",
"control_star_vectors = []\n",
"sensor_vectors = []\n",
"for time_step in range(n):\n",
" gain_matrices.append(Matrix(q, p, lambda i, j: Symbol('k^{}_q={},p={}'.format(time_step, i, j))))\n",
" control_vectors.append(Matrix(q, 1, lambda i, j: Symbol('m^{}_m_q={}'.format(time_step, i))))\n",
" control_star_vectors.append(Matrix(q, 1, lambda i, j: Symbol('m^*{}_q={}'.format(time_step, i))))\n",
" sensor_vectors.append(Matrix(p, 1, lambda i, j: Symbol('s^{}_m_p={}'.format(time_step, i))))"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 15
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"gain_matrices"
],
"language": "python",
"metadata": {},
"outputs": [
{
"latex": [
"$$\\begin{bmatrix}\\left[\\begin{smallmatrix}{}k^{0}_{q=0,p=0} & k^{0}_{q=0,p=1}\\\\k^{0}_{q=1,p=0} & k^{0}_{q=1,p=1}\\end{smallmatrix}\\right], & \\left[\\begin{smallmatrix}{}k^{1}_{q=0,p=0} & k^{1}_{q=0,p=1}\\\\k^{1}_{q=1,p=0} & k^{1}_{q=1,p=1}\\end{smallmatrix}\\right], & \\left[\\begin{smallmatrix}{}k^{2}_{q=0,p=0} & k^{2}_{q=0,p=1}\\\\k^{2}_{q=1,p=0} & k^{2}_{q=1,p=1}\\end{smallmatrix}\\right]\\end{bmatrix}$$"
],
"metadata": {},
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAi4AAAAqBAMAAABmas3TAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEO+Zu3ZEIondMqvN\nZlSyKd/8AAAFjklEQVRoBe1aTYgcVRCuXje7M5PdyZJ4iChsuyJ6XAQRAtERNggeZJENBCUYL2u8\njR6EnJxEJYGwsoI/4MUhGFDwoAdPC7K3gCAERFgvMiAK3gzx4sXYr96b7tfVr6re9vQsiziH2X6v\nq75X8/Xr6ur6FqD0SbYul8ahwcm9pdB03NzRCN9v4qBCVp1rz4WmS3NfvNsvjWMGs0v3q2bPJj3V\nhjOYu6LHdPExzlufn4XXVaPe3LZqQw2OwYx6Qf+Eh6lb/Lit8wKfxMNRywVYVuPfTe5Qt8D4+Moj\nkKysrAIceRzgTWgPA0bjKWMyn8Kn43H17xMrIdLMIogPCi8vDjJIiRcNH/6oxuTNIH5325shh4hv\nvo5nJ5I0+wL4WOXFmMi8QHAzmUUQX+OlfSGzk3jR8JNbZiX2g/gPiXsWr6vPi9leyn2EO1C5j4L7\nxQSKzsp+wbugJi+I/6B8Gxn8RM7rFV5MOlLyLmYsJe+yvKCzwgtmzZq8GPzkqZPsXjEnDP6JNwbm\nkPtUeGmt3vw6OX2VszfzxgRO7PUlG5YX49x55WnJF97pvAw3744kGxG/fe9vyRfxP7uXEch/Krws\n/PKqlqgjTPj8EuP8w+/q84TlpUl8P78cO8WT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20+8jwEoFf6AEWsJ4eQIPzXnZzvYHiC7zk/XSDq+gB1CSGlwh8yPUAA1hX\nD6DBec0RFr/Ey/LaGUj+Wls3V9Pr15vmuKIHUBPs12+sld8YLaxZBD+5HkCdQ3pABljRA6aIj3oA\n4puvuc3sFWxzs2/jjurXp2PbgGTw1uaF4mx+hIvYUZpPsnqDpAccCH5gkYh+fYRJ8dvpUYyzrAdQ\nxPK4Kfx/ARSk9V4KMxp4AAAAAElFTkSuQmCC\n",
"prompt_number": 16,
"text": [
"\u23a1\u23a1k^0_q=0,p=0 k^0_q=0,p=1\u23a4, \u23a1k^1_q=0,p=0 k^1_q=0,p=1\u23a4, \u23a1k^2_q=0,p=0 k^2_q=0\n",
"\u23a2\u23a2 \u23a5 \u23a2 \u23a5 \u23a2 \n",
"\u23a3\u23a3k^0_q=1,p=0 k^0_q=1,p=1\u23a6 \u23a3k^1_q=1,p=0 k^1_q=1,p=1\u23a6 \u23a3k^2_q=1,p=0 k^2_q=1\n",
"\n",
",p=1\u23a4\u23a4\n",
" \u23a5\u23a5\n",
",p=1\u23a6\u23a6"
]
}
],
"prompt_number": 16
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"control_vectors"
],
"language": "python",
"metadata": {},
"outputs": [
{
"latex": [
"$$\\begin{bmatrix}\\left[\\begin{smallmatrix}{}m^{0}_{m q=0}\\\\m^{0}_{m q=1}\\end{smallmatrix}\\right], & \\left[\\begin{smallmatrix}{}m^{1}_{m q=0}\\\\m^{1}_{m q=1}\\end{smallmatrix}\\right], & \\left[\\begin{smallmatrix}{}m^{2}_{m q=0}\\\\m^{2}_{m q=1}\\end{smallmatrix}\\right]\\end{bmatrix}$$"
],
"metadata": {},
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAATgAAAAqBAMAAADVOFp9AAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEO+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SuQmCC\n",
"prompt_number": 17,
"text": [
"\u23a1\u23a1m^0_m_q=0\u23a4, \u23a1m^1_m_q=0\u23a4, \u23a1m^2_m_q=0\u23a4\u23a4\n",
"\u23a2\u23a2 \u23a5 \u23a2 \u23a5 \u23a2 \u23a5\u23a5\n",
"\u23a3\u23a3m^0_m_q=1\u23a6 \u23a3m^1_m_q=1\u23a6 \u23a3m^2_m_q=1\u23a6\u23a6"
]
}
],
"prompt_number": 17
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"control_star_vectors"
],
"language": "python",
"metadata": {},
"outputs": [
{
"latex": [
"$$\\begin{bmatrix}\\left[\\begin{smallmatrix}{}m^{*0}_{q=0}\\\\m^{*0}_{q=1}\\end{smallmatrix}\\right], & \\left[\\begin{smallmatrix}{}m^{*1}_{q=0}\\\\m^{*1}_{q=1}\\end{smallmatrix}\\right], & \\left[\\begin{smallmatrix}{}m^{*2}_{q=0}\\\\m^{*2}_{q=1}\\end{smallmatrix}\\right]\\end{bmatrix}$$"
],
"metadata": {},
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAARIAAAAqBAMAAACNR8lkAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEO+Zu3ZEImYyq92J\nVM0hoUD5AAAEdUlEQVRYCc1YO2hUQRS9k5jdjZvoww9YiI5rIVoFKwvFFWJhZcBEQQXTuIIIrhYW\nIhjxA6LFItpZJIUIQSFWoiAmoihWAUst7MQuooiNn/ndyX0zd95bY+MU87v33DmZOzPvbAC4It7M\ncdMFc1MFNs5092Wbm47mlmVrornCiVNbCs2xsVmZiSeZmZXQkzHTBVOPC2yc6aP4Ek6vamwGMBVa\nahmchXrHDnsbDYaTaDSG0B3gkup6Jjwgt4ABDM64ANsbmwB0tUpPmMpZBl+dJEyA3R0hnbNuPhyc\nJEx4AF3AAja0fQjFBIBhAu/vA80OlychNdiV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2AqR9lr+/5juwD6hvebu4x/j23Ft+ERP4NS3f4T\nhQfQBby2NwvA6LD6uOqq0lLfNlP50NL31I/fVouMfLfVMvfKjnPangfkF8gBzrXGAUzlo2Mn0PY4\nnW4DqZ52RAsL+AN8jEJslCydcAAAAABJRU5ErkJggg==\n",
"prompt_number": 18,
"text": [
"\u23a1\u23a1m^*0_q=0\u23a4, \u23a1m^*1_q=0\u23a4, \u23a1m^*2_q=0\u23a4\u23a4\n",
"\u23a2\u23a2 \u23a5 \u23a2 \u23a5 \u23a2 \u23a5\u23a5\n",
"\u23a3\u23a3m^*0_q=1\u23a6 \u23a3m^*1_q=1\u23a6 \u23a3m^*2_q=1\u23a6\u23a6"
]
}
],
"prompt_number": 18
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"sensor_vectors"
],
"language": "python",
"metadata": {},
"outputs": [
{
"latex": [
"$$\\begin{bmatrix}\\left[\\begin{smallmatrix}{}s^{0}_{m p=0}\\\\s^{0}_{m p=1}\\end{smallmatrix}\\right], & \\left[\\begin{smallmatrix}{}s^{1}_{m p=0}\\\\s^{1}_{m p=1}\\end{smallmatrix}\\right], & \\left[\\begin{smallmatrix}{}s^{2}_{m p=0}\\\\s^{2}_{m p=1}\\end{smallmatrix}\\right]\\end{bmatrix}$$"
],
"metadata": {},
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAASQAAAAqBAMAAADoqjsbAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEO+Zu3ZEIolUMqvd\nZs0eYxJ8AAAEAklEQVRYCd2YPWgUQRiGv8nv3eVOY7QIJJLxLMQuCEYiCBFORBtTmKhFNNWpYHFY\nWKWIgmiUwIkEUyhcoZUgWqTQFKZQhDQGQiCNkM5W0UrEOD87m53Zd2c3cgg6xfzcfO83z84sk31D\nZJXe9W5rnGXQtX1J4e7JLJlVzHE2kjk2COy4Vdu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ShZkBI0EMl1KFmQHIeSCQlrAqSBygli3yuj6oHJdSjPvtWpvXKmW89G61Djug31\n/yaskWupAjVnK1+JZNVRvUxUrdaiy9kOpbNajU6avqOx3QbWqLWMXrS25kZ1kkhVkRDTdR2K+d3T\nxtyGJ9ZMJWh+A5QnM2g1BTWuAAAAAElFTkSuQmCC\n",
"prompt_number": 19,
"text": [
"\u23a1\u23a1s^0_m_p=0\u23a4, \u23a1s^1_m_p=0\u23a4, \u23a1s^2_m_p=0\u23a4\u23a4\n",
"\u23a2\u23a2 \u23a5 \u23a2 \u23a5 \u23a2 \u23a5\u23a5\n",
"\u23a3\u23a3s^0_m_p=1\u23a6 \u23a3s^1_m_p=1\u23a6 \u23a3s^2_m_p=1\u23a6\u23a6"
]
}
],
"prompt_number": 19
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Picking off a trio we should get our familiar equation back:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"zero = control_vectors[0] - control_star_vectors[0] + gain_matrices[0] * sensor_vectors[0]\n",
"zero"
],
"language": "python",
"metadata": {},
"outputs": [
{
"latex": [
"$$\\left[\\begin{smallmatrix}{}k^{0}_{q=0,p=0} s^{0}_{m p=0} + k^{0}_{q=0,p=1} s^{0}_{m p=1} - m^{*0}_{q=0} + m^{0}_{m q=0}\\\\k^{0}_{q=1,p=0} s^{0}_{m p=0} + k^{0}_{q=1,p=1} s^{0}_{m p=1} - m^{*0}_{q=1} + m^{0}_{m q=1}\\end{smallmatrix}\\right]$$"
],
"metadata": {},
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAAqBAMAAAC6iQZQAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEO+Zu3ZEIondMqvN\nZlSyKd/8AAAFc0lEQVRYCe1YTYgcRRR+8/+302mjgsFDxhVRUGQuBhGMHdhccoiLZGIwro4H10hA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
"source": [
"The larger A matrix for all of the time steps can be formed by stacking the A matrices from a single time step diagonally:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"Am = zeros(n * q, n * (q + q * p))\n",
"for time_step in range(n):\n",
" An = zeros(q, q * p)\n",
" for row in range(q):\n",
" An[row, row * p:(row + 1) * p] = sensor_vectors[time_step].T\n",
" An = An.row_join(-eye(q))\n",
" num_rows, num_cols = An.shape\n",
" Am[time_step * num_rows:(time_step + 1) * num_rows, time_step * num_cols:(time_step + 1) * num_cols] = An"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 21
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"Am"
],
"language": "python",
"metadata": {},
"outputs": [
{
"latex": [
"$$\\left[\\begin{smallmatrix}{}s^{0}_{m p=0} & s^{0}_{m p=1} & 0 & 0 & -1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\\\0 & 0 & s^{0}_{m p=0} & s^{0}_{m p=1} & 0 & -1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0 & 0 & s^{1}_{m p=0} & s^{1}_{m p=1} & 0 & 0 & -1 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & s^{1}_{m p=0} & s^{1}_{m p=1} & 0 & -1 & 0 & 0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & s^{2}_{m p=0} & s^{2}_{m p=1} & 0 & 0 & -1 & 0\\\\0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & s^{2}_{m p=0} & s^{2}_{m p=1} & 0 & -1\\end{smallmatrix}\\right]$$"
],
"metadata": {},
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAywAAACECAMAAABF91+xAAAAP1B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ncMsVRorpZn5m7Fk/yZCE4dIYICixL3VkLEZrlSRkWFibYhMdaNwBQxKGD8vMxQAlt3JYZiz6dxqW\n9L8JXK8vKCb8ogNNO2BIwrC3YQsRA3TjsOTfPNMjXV5wGB+vS95YRAce2QFDEoZ9wF94GqAbh+Uy\nzciSLRbRgS46YEnC/AIdmS6OQ5B4tg7kS4OrHy5QdZYARAe66oBLEsYFwsr+P9uzDyDJ0+lIAAAA\nAElFTkSuQmCC\n",
"prompt_number": 22,
"text": [
"\u23a1s^0_m_p=0 s^0_m_p=1 0 0 -1 0 0 0 \n",
"\u23a2 \n",
"\u23a2 0 0 s^0_m_p=0 s^0_m_p=1 0 -1 0 0 \n",
"\u23a2 \n",
"\u23a2 0 0 0 0 0 0 s^1_m_p=0 s^1_m_p=1 \n",
"\u23a2 \n",
"\u23a2 0 0 0 0 0 0 0 0 s^1\n",
"\u23a2 \n",
"\u23a2 0 0 0 0 0 0 0 0 \n",
"\u23a2 \n",
"\u23a3 0 0 0 0 0 0 0 0 \n",
"\n",
" 0 0 0 0 0 0 0 0 0 0 \u23a4\n",
" \u23a5\n",
" 0 0 0 0 0 0 0 0 0 0 \u23a5\n",
" \u23a5\n",
" 0 0 -1 0 0 0 0 0 0 0 \u23a5\n",
" \u23a5\n",
"_m_p=0 s^1_m_p=1 0 -1 0 0 0 0 0 0 \u23a5\n",
" \u23a5\n",
" 0 0 0 0 s^2_m_p=0 s^2_m_p=1 0 0 -1 0 \u23a5\n",
" \u23a5\n",
" 0 0 0 0 0 0 s^2_m_p=0 s^2_m_p=1 0 -1\u23a6"
]
}
],
"prompt_number": 22
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The control vector and the gain vector are simple column stacks:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"bm = -control_vectors[0]\n",
"for control in control_vectors[1:]:\n",
" bm = bm.col_join(-control)\n",
"bm"
],
"language": "python",
"metadata": {},
"outputs": [
{
"latex": [
"$$\\left[\\begin{smallmatrix}{}- m^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n4nX8WnmckPWZjIW7LZnMzd10lUi5QP/ajWy+8QOQL8zdZ5xSx918BSu4m3kHR6Z/m+rug4r+dN+w\n1d0s+MV9g3E3fZ6DEXF32Rr0avltPMp+jCxnBTXId0VP15COyhX9WXRTnN2oUNFbvG6HLU5YkJsY\np/ztlghsOpvAI58xHRjqWtL5rALiCHhq5efjYomL4nipgEhUHghtU71e5ySq9w2fjvSUzbKC4C3Z\nlwXZd4MvH22+H8mCnA719XYWkVlW8NZG9ysj11b0Z75xmayAHZiJ1rC9jWcHZiKyLStgB2YiMssK\nZO6+K/r7JH3dNX4Ed6/aqjpipDCEK2UFZ7soUxlsWYHFGngnQ1ZgQ/6vswLG3X8yK/jnufug7j6P\nFFNFz+pu0Z9t3G2pjk3cjRFKMnxRZ7ZxXKvuVn09i08rfgW3WWP9etanj11d+r5NboW38duB2fL1\nrMPTpU+bXHd/iorXFbgbJX4D5s49FG12xmIAAAAASUVORK5CYII=\n",
"prompt_number": 23,
"text": [
"\u23a1-m^0_m_q=0\u23a4\n",
"\u23a2 \u23a5\n",
"\u23a2-m^0_m_q=1\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2-m^1_m_q=0\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2-m^1_m_q=1\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2-m^2_m_q=0\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a3-m^2_m_q=1\u23a6"
]
}
],
"prompt_number": 23
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"xm = gain_matrices[0].reshape(q * p, 1).col_join(control_star_vectors[0])\n",
"for gain, control_star in zip(gain_matrices[1:], control_star_vectors[1:]):\n",
" xm = xm.col_join(gain.reshape(q * p, 1)).col_join(control_star)\n",
"xm"
],
"language": "python",
"metadata": {},
"outputs": [
{
"latex": [
"$$\\left[\\begin{smallmatrix}{}k^{0}_{q=0,p=0}\\\\k^{0}_{q=0,p=1}\\\\k^{0}_{q=1,p=0}\\\\k^{0}_{q=1,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23a2k^0_q=0,p=1\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2k^0_q=1,p=0\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2k^0_q=1,p=1\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2 m^*0_q=0 \u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2 m^*0_q=1 \u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2k^1_q=0,p=0\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2k^1_q=0,p=1\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2k^1_q=1,p=0\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2k^1_q=1,p=1\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2 m^*1_q=0 \u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2 m^*1_q=1 \u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2k^2_q=0,p=0\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2k^2_q=0,p=1\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2k^2_q=1,p=0\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2k^2_q=1,p=1\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2 m^*2_q=0 \u23a5\n",
"\u23a2 \u23a5\n",
"\u23a3 m^*2_q=1 \u23a6"
]
}
],
"prompt_number": 24
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now the original equations can be regenerated with:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"Am * xm - bm"
],
"language": "python",
"metadata": {},
"outputs": [
{
"latex": [
"$$\\left[\\begin{smallmatrix}{}k^{0}_{q=0,p=0} s^{0}_{m p=0} + k^{0}_{q=0,p=1} s^{0}_{m p=1} - m^{*0}_{q=0} + m^{0}_{m q=0}\\\\k^{0}_{q=1,p=0} s^{0}_{m p=0} + k^{0}_{q=1,p=1} s^{0}_{m p=1} - m^{*0}_{q=1} + m^{0}_{m q=1}\\\\k^{1}_{q=0,p=0} s^{1}_{m p=0} + k^{1}_{q=0,p=1} s^{1}_{m p=1} - m^{*1}_{q=0} + m^{1}_{m q=0}\\\\k^{1}_{q=1,p=0} s^{1}_{m p=0} + k^{1}_{q=1,p=1} s^{1}_{m p=1} - m^{*1}_{q=1} + m^{1}_{m q=1}\\\\k^{2}_{q=0,p=0} s^{2}_{m p=0} + k^{2}_{q=0,p=1} s^{2}_{m p=1} - m^{*2}_{q=0} + m^{2}_{m q=0}\\\\k^{2}_{q=1,p=0} s^{2}_{m p=0} + k^{2}_{q=1,p=1} s^{2}_{m p=1} - m^{*2}_{q=1} + m^{2}_{m q=1}\\end{smallmatrix}\\right]$$"
],
"metadata": {},
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAXsAAACDCAMAAABbVkv5AAAANlBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABHL6OuAAAAEXRSTlMAMquZdlQQ\nQN0iRO+JzWa7fNDgyowAAA/USURBVHgB7V3tlqo4EERF15nx6vr+L7sdkk76g07SRMc958KPgUBX\nV6cEBFKD07Q6XW7322V1S9fKIfgQGMobxZMe+lL5ogkNX3xcpsuDr/K0huBDYKhyFE866kvliyY0\nfPEJzZ/tO/4QfAgMdY/iiRK+VL5oQrMszj+3Zf71A7PrQW7ubW+DJ/Jt4FLaKD5muocdz5fKFx1o\nDs9lOkbK6/cy96eJ8PTXBY+MARnJXWBGGxuj+JDlfJu/QRErVSmZ8lvRNGZZvkbJg/anGabzsvby\nTOeZscPHddjnrxUkH+R2kStd0orz9fgFi0YpuWQON6J5ELTuQfAjRB+e5NTyfU2Bg18bHnjuCJJ7\nwKpfsGIUDym+v+evcJ1npMolc3ojmgdh6y61v52mwxxOP5fT/RY+ePd0Ww4hDzx3BMk9YF6fnxzx\n99P9MM+naZ4fcVeMpxWjFCxZoIxo5OBzpf2f+/kbD30e2tk6fU8HrKwTksM/QY413r+fd7iy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1_m_p=1 - m^*1_q=0 + m^1_m_q=0\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2k^1_q=1,p=0\u22c5s^1_m_p=0 + k^1_q=1,p=1\u22c5s^1_m_p=1 - m^*1_q=1 + m^1_m_q=1\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2k^2_q=0,p=0\u22c5s^2_m_p=0 + k^2_q=0,p=1\u22c5s^2_m_p=1 - m^*2_q=0 + m^2_m_q=0\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a3k^2_q=1,p=0\u22c5s^2_m_p=0 + k^2_q=1,p=1\u22c5s^2_m_p=1 - m^*2_q=1 + m^2_m_q=1\u23a6"
]
}
],
"prompt_number": 25
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We have $n(p q + q)$ unknowns and $nq$ equations so we need at least $1 + p$ cycles to solve for the unknowns."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"n * (p*q + q)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"latex": [
"$$18$$"
],
"metadata": {},
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAABMAAAAPBAMAAAD0aukfAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAzRAiu5mrdu/dZolE\nVDLjuNgcAAAAeklEQVQIHWNgYBBiYGAq33qAgYHB5BMDAysDQy4Dg0oYkHmLgcEQKMoOZG5hYNCE\nMs87MeyCMtn+r14AZTLEf1SAMrni5HugzGUMXD+AwiATmhgY3l8AM5k+MDCwLYCINjMwsBhAmAcV\nGJYDrc/4mcXAlwp2DtAQCAAASJ4i3e599ZEAAAAASUVORK5CYII=\n",
"prompt_number": 26,
"text": [
"18"
]
}
],
"prompt_number": 26
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"1 + p"
],
"language": "python",
"metadata": {},
"outputs": [
{
"latex": [
"$$3$$"
],
"metadata": {},
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAOBAMAAADkjZCYAAAALVBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAOrOgAAAADnRSTlMAIom7VJlmdt1E7xDNMpCR\nWcAAAABSSURBVAgdY2AQUjJhYGAMYPBLYGB/wsDXwMC5kmHfAQYgAIoAwVEg5tUIADEZtC6ASK7V\nDIwCDMxAxa8ZmJ8xcBkwcDxkYEtg8CtgYJgaaskAAFKHDvy4QzOnAAAAAElFTkSuQmCC\n",
"prompt_number": 27,
"text": [
"3"
]
}
],
"prompt_number": 27
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"Am.shape, bm.shape"
],
"language": "python",
"metadata": {},
"outputs": [
{
"latex": [
"$$\\begin{pmatrix}\\begin{pmatrix}6, & 18\\end{pmatrix}, & \\begin{pmatrix}6, & 1\\end{pmatrix}\\end{pmatrix}$$"
],
"metadata": {},
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAALoAAAAaBAMAAADyPFssAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAMkS7zRCZdiKJ71Rm\nq90icBAQAAACxElEQVRIDZ2VPWhTURTH/y9NXl6blxh0c2kGV2lAHNziIFJQDNhJxMRvHMROik6B\nulsQKgWHIAiCy5tcdHibVChEBAd10EEnwVpaKFbU/znvI++93NvBA7nn3HPO79zvFwD7ATgtNnZZ\nNIeENEpVvAo5bVoHjEmp83BqZQ0ls47ULo1oKlTu0jqRBozGdGhyK2kKAI/pVug6DVdWsXq3WUzl\noJU7Ky3gazEifSHNEBoyZULeNvUDdhZabodmVpYYc4GPwO2sO7aFtECo9plEaFr0Cn/zmGpTZeTs\nTfKvgPscPuNOTCEtELwNZhGaCaifA/5OQo11ldUfAheARjj2JhZJGwR8ZxahWW6KwypTw4Qaa6k+\nd1SOyC0sS3JI2iDgMhMIvaHyh8C+448u0cyJVK//XQuB6jAX0A5JGwTcYwqhK1RynL1T0SYpGDdS\nHbe2uLqSWAUhaYUwF0FHyMhx9rbhPi3wUt2/eOYJ9+5nIcQuSRvEbWsqdJp55REX+Rn+ZqGEVF+H\n/6sLrxhiJkkbxPvS4mXfxDfmNfq8Ox34v2lnRapzPbMBvN2sP7JJ2iBWD1h9V2agc+fxm+Ze2eDB\nhra5WyCWjOeeVK9x34fRpNJW5v6MxzKAY3gNJG0Q1zvgvu/gHWvV22yO4VxQ2UoriyHVD3Xx2nxn\nhLRAfCZdheKLyU/CtbfADzpTcT/8+QTnvXzF5EWgMLaQFgjJM4oHYaZIaaBqooneam5snZ4mmqD4\nrc60mMEbHYmfGAVdXhRHvoyS4jZBJ+kn5C5T35AkkfORmmh7umP5MkpaoApPDIScIfVBSRIJtZ1s\n1tWVH1tJ8YcazDX+iF2B+N+AepCLTXa+qCvMB4S0SKPJgEAL/FU6bPYQf9kUFNIia/QrVOvTemHJ\nit1LxrCSxojXpjuCXtKq7b01V401IKRR3C7dFsgI/JfzH5YmuXfLGAVgAAAAAElFTkSuQmCC\n",
"prompt_number": 28,
"text": [
"((6, 18), (6, 1))"
]
}
],
"prompt_number": 28
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"b = bm\n",
"A = Am\n",
"for step in range(p):\n",
" b = b.col_join(bm)\n",
" A = A.col_join(Am)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 29
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"A.shape, b.shape"
],
"language": "python",
"metadata": {},
"outputs": [
{
"latex": [
"$$\\begin{pmatrix}\\begin{pmatrix}18, & 18\\end{pmatrix}, & \\begin{pmatrix}18, & 1\\end{pmatrix}\\end{pmatrix}$$"
],
"metadata": {},
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAANAAAAAaBAMAAAA0+c+VAAAAMFBMVEX///8AAAAAAAAAAAAA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cpVGh2S2WipJ+\nu4gaVuOjURntwKmYbKGrtArxs0KawTk6FXlOq0IzOIKwMDe6WIhTeJVGJSX/uf0HSmHWidRWRpoA\nAAAASUVORK5CYII=\n",
"prompt_number": 30,
"text": [
"((18, 18), (18, 1))"
]
}
],
"prompt_number": 30
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The following should compute the least squares solution but since I didn't actually create new equations for the steps, then you get NaN as a solution."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"x = A.LDLsolve(b)\n",
"x"
],
"language": "python",
"metadata": {},
"outputs": [
{
"latex": [
"$$\\left[\\begin{smallmatrix}{}\\bot\\\\\\bot\\\\\\bot\\\\\\bot\\\\\\bot\\\\\\bot\\\\\\bot\\\\\\bot\\\\\\bot\\\\\\bot\\\\\\bot\\\\\\bot\\\\\\bot\\\\\\bot\\\\\\bot\\\\\\bot\\\\\\bot\\\\\\bot\\end{smallmatrix}\\right]$$"
],
"metadata": {},
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAACQAAADrCAMAAAA2YMTLAAAAM1BMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADxgEwMAAAAEHRSTlMAMquZdlQQQN0i\nRLuJ72Z8fOynKQAAAZtJREFUaAXtmuF2gjAMhYtWxOmU939aIT0XanoV1sFWMf1B0MS25ssNHMW5\nrLGb86nz/wdVrYxxu9GemuBzrmr3vhuHYbtR0LX37No+qBr8chIFyetrTtDl3I3v/nAZZ6czje5w\ntnLQmLEXyy2SApl/szMZ4FA/BjjkITqurOBoJTmly2XL/NgeHxfQgG857VCm1DPRjRcW9FYyr339\nmt3Jr3W9M8CPmccrWuNwwtIgpmAT589v10pRcCJODdjE6agQpq4IpQBOxKkBf9aVU5rbFLtZQX8A\nOBEnWjMsFSecsLR8dRXQoEXyJNvY7Ey/q4JEnGAGS8UJJyxlZ4DdIkX3FPCK4gRYWAOcdw2W/E1V\nwVPAK4oTYGEN8MKAY3YUcH5jBTNYyg5OWBpkLZq26KSxagXrux4KmGYcOGBLCPq8KojFKSQ0YCpO\nHaTZFVsFmwI8T5zNCQoLVrM7NBm/+BlgnkwtBCqpdwgywAY4ZCA50vLVUflBRbToGY8O1P3jAd5/\nDd88aqzy6IDv/kpJRhSU+IY3FgmiCu6WuAMhFTqkOvNfLgAAAABJRU5ErkJggg==\n",
"prompt_number": 31,
"text": [
"\u23a1nan\u23a4\n",
"\u23a2 \u23a5\n",
"\u23a2nan\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2nan\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2nan\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2nan\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2nan\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2nan\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2nan\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2nan\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2nan\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2nan\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2nan\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2nan\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2nan\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2nan\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2nan\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a2nan\u23a5\n",
"\u23a2 \u23a5\n",
"\u23a3nan\u23a6"
]
}
],
"prompt_number": 31
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"type(x[0])"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 32,
"text": [
"sympy.core.numbers.NaN"
]
}
],
"prompt_number": 32
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.