##// END OF EJS Templates
Merge pull request #830 from minrk/stream...
Merge pull request #830 from minrk/stream Several improvements to stdout/stderr handling and visual layout of cells. Now stdout and stderr are kept contiguous (in a single div) if they are being written to continuously, and stderr is shown with a light red background to help distinguish from stdout. Further, input cells now have a light gray background to help distinguish them from plain stdout areas.

File last commit:

r4637:d919e2ec
r4906:ca814f85 merge
Show More
quantum_computing.ipynb
424 lines | 76.1 KiB | text/plain | TextLexer
/ docs / examples / notebooks / quantum_computing.ipynb
Brian E. Granger
Converting notebooks to JSON format.
r4634 {
"nbformat": 2,
Brian E. Granger
Implemented metadata for notebook format.
r4637 "metadata": {
"name": "quantum_computing"
},
Brian E. Granger
Converting notebooks to JSON format.
r4634 "worksheets": [
{
"cells": [
{
"source": "<h1>Symbolic Quantum Computing</h1>",
"cell_type": "markdown"
},
{
"cell_type": "code",
"language": "python",
"outputs": [],
"collapsed": true,
"prompt_number": 1,
"input": "%load_ext sympyprinting"
},
{
"cell_type": "code",
"language": "python",
"outputs": [],
"collapsed": true,
"prompt_number": 2,
"input": "from sympy import sqrt, symbols, Rational\nfrom sympy import expand, Eq, Symbol, simplify, exp, sin\nfrom sympy.physics.quantum import *\nfrom sympy.physics.quantum.qubit import *\nfrom sympy.physics.quantum.gate import *\nfrom sympy.physics.quantum.grover import *\nfrom sympy.physics.quantum.qft import QFT, IQFT, Fourier\nfrom sympy.physics.quantum.circuitplot import circuit_plot"
},
{
"source": "<h2>Qubits</h2>",
"cell_type": "markdown"
},
{
"source": "The state of a set of qubits (Two state systems) is the quantum state that is of interest in Quantum Computing.",
"cell_type": "markdown"
},
{
"cell_type": "code",
"language": "python",
"outputs": [],
"collapsed": true,
"prompt_number": 3,
"input": "alpha, beta = symbols('alpha beta',real=True)"
},
{
"cell_type": "code",
"language": "python",
"outputs": [
{
"output_type": "pyout",
"latex": "$$\\alpha {\\left|00\\right\\rangle } + \\beta {\\left|11\\right\\rangle }$$",
"prompt_number": 4,
"png": "iVBORw0KGgoAAAANSUhEUgAA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bxJXFeaX3fVgtTuBzM31qSzyMR3Ar9s1sZ+FwY6eXRnWn472JfWoJv+EfnFiwzRZn\npnvFd5mIWVk60do1nq4hn6djjZi3V4sNxGXZux68i/uz5wW4uJS/S9w9DeAhsUM8J1FPI7p+zR+0\nq9w4zMct4gC5SlxXrcWzYmdXJOXzOrET2ylmor+z/2ua0E3G5/8dVTppufacwybFnthzO6RvNVIs\nNLpOdviP8uhUN6AR9sRIapQ5ai96O3To0KHD1PEvn5jpFWKUSuUAAAAASUVORK5CYII=\n",
"text": "\u03b1\u22c5\u275800\u27e9 + \u03b2\u22c5\u275811\u27e9"
}
],
"collapsed": false,
"prompt_number": 4,
"input": "psi = alpha*Qubit('00') + beta*Qubit('11'); psi\n"
},
{
"cell_type": "code",
"language": "python",
"outputs": [
{
"output_type": "pyout",
"latex": "$$\\alpha {\\left\\langle 00\\right|} + \\beta {\\left\\langle 11\\right|}$$",
"prompt_number": 5,
"png": "iVBORw0KGgoAAAANSUhEUgAAAGgAAAAXCAYAAADnaAq1AAAABHNCSVQICAgIfAhkiAAAA6NJREFU\naIHt2FuMXVMcx/GPKpOUiBoz1SJENG4xoiHtQ0VLEbQiIWFEE0EQJCKqjadOJOJSEoroQ0WCTDzg\nwS28uD64RYR6E0LRS0KkdFqiZjz810737NnnzN4zc86M5nyTnbX3Wr+91vrvtf//daHDAc/a6e7A\nNNA2m2dP8v2z8W1J/nLcmcqG8QuenqBuLR6ZZD/rshpLMIRTsQlvpbJGNmdchxW4cZw2mummzOb1\nxg7y6diDhel5Nj7GPRPUDUxFRyvSJT7M4lzeIvyDnvRcZjMcj7uwDy82aaOKbiC7mVWh0404ArtT\nQ3nuEx86+8v2YRAP4YQJ6Opy1CTevxfP4dNc3h9iQPo0tvkOPIhDcVCT+qvqpoRbsaCQd5z424ox\neiFGcEtNHfU9aCXW1HyHCDdXluTfhr/QrdzmIuN5UBXdQHYzGQ9agG2FvLPE31aM0d+ldFlNXTu5\nDK8V8rrFT7QGvym3uaWUxdKT0C9iZS92Yp1wdcI1l+KjknePSenuQv4w9mJ+TV276MGPqf1lwmuO\nFGFtE57CecptbilFD+rD+/hSdPJqMSCDOe3juBDvltSXffihkrIhYXQdXbtYbr89Q+naga24Xcw9\njWxuKfkBOhnvYLP9S8phvI7LcQ6OFa7+Hi4oqe/v3HtFDsnlV9W1i9PwTbr/HDfhBhE55uEKjW1u\nKfkBuj+ljxU0X6d0sej4ZnyA80vq29KkrcOwvaaunYyU5P2Q0l6NbW4p2Rw0CxfhTWPDzk8pXSI6\nnE2S24ydNLPBnFuooyu1taOmrhmrjd0zEeGoC9eXlL0klvF55jVp75SUfpHSMptbSjZAZ+Bo+928\njDOFB2UM4majPW47fhULjDznpnRLTV0zXkhXkZVi9/9ohTqIRcHPDcr6xSLps/RcZnNLyULcVuHi\nO0s0h4s54W2xH8jYlcoOLui/wqWFvBX4Hc9OQNdqlopBLXIirhGby70pr5HNLSMboF14BZcUyldg\ng9hZ9yZ9fjP3BlYV3lmPi8XEC3NwLTYavayuqms1f+JfsTfL6BZ7ogfEd8lTZnPGXLHq7dH8pKCq\nbhRdeFLE6Q3Cja9KZX1iknw43edZV1LXKryKJ/CyGIyyv66K7u6qBiTqnCTMF+dic8QZ3PN4Ruzw\nmy0Iijb34xMRtkfS9T0+NHpPV1VX1+b/FXUGqF8chs5YJnPUM1PZo3qIXCTmwg4zlI3T3YHxOBA9\nqCo92nzw2aFDhw4dRvEfMafj+g/WzT4AAAAASUVORK5CYII=\n",
"text": "\u03b1\u22c5\u27e800\u2758 + \u03b2\u22c5\u27e811\u2758"
}
],
"collapsed": false,
"prompt_number": 5,
"input": "Dagger(psi)\n"
},
{
"cell_type": "code",
"language": "python",
"outputs": [
{
"output_type": "pyout",
"latex": "$$\\alpha$$",
"prompt_number": 6,
"png": "iVBORw0KGgoAAAANSUhEUgAAAA4AAAANCAYAAACZ3F9/AAAABHNCSVQICAgIfAhkiAAAAMlJREFU\nKJHV0TFOQlEQheHP12CCLRYQGkLrK4kL0JBIY+si6Ejs3AA0hMYNaGdnoRsw0LoETDSUkJhQAQXz\nErh5lZ3TzJ0z+WfOzfDHOCnRWrhDE+dY4B6rA2abQjnmuIk6wyNe4w3jFGrjBw+J3osNHTRK+p4D\nrCZ6M8B+QPXCSpGv8Y7fBPyKfIkKvg+bFzF1kNqI2OITp4VQbJxHc1ECnWGDN6xTcIkXdBPoCkPM\n7E+T4ZbjO1YwQi3+leEjBuaYYIqnsP1fYgcPriV+6UcWLAAAAABJRU5ErkJggg==\n",
"text": "\u03b1"
}
],
"collapsed": false,
"prompt_number": 6,
"input": "qapply(Dagger(Qubit('00'))*psi)\n"
},
{
"source": "SymPy supports many different types of measurements.",
"cell_type": "markdown"
},
{
"cell_type": "code",
"language": "python",
"outputs": [
{
"output_type": "display_data",
"latex": "$${\\left|00\\right\\rangle }$$",
"png": "iVBORw0KGgoAAAANSUhEUgAAAB8AAAATCAYAAABobNZCAAAABHNCSVQICAgIfAhkiAAAAWdJREFU\nSInt1btLHUEUx/EPEjU+ICbiozBqq2AaCWKa1IqVpdX9A2xsJLWFhWhhmzqlpQqCTSzsDekUCULw\nURgCXvMQrhazN4x7181umkDID4Yze853+A07Z3b5x/XmocKjaD6H9/iMLqyhiks8xlscp9YX4aro\nxUXeDisYTua7WEnVPqI9taYI142FPOPYfAK3GIlqbfiG5ShXlIMlNBUx38BJRn0HH6Lnohy8wnQa\nzNrNOA4z8kcYE15jGQ72kw381rwPVxn5ahL7S3J1nWAoz/yJcG5VjarnukpwsTYxk2d+g1oy0mpO\nYq0EF2sGW3nm1xrvcl0dSTwtwcUaxqc8c0KnPs3IdybxrCQHk0LT3dND5s8z8i+FTv5ekoMpbBcx\nP8AoBqNcD15g9Q+4Z/giuz9+qSKcSwv2sB7VFoVvfmuUK8rNC9eyQfGP5Ro/kzErfCLf4SsG8Bo/\nIr4o14nzLPP/+iu6A4BqY/+ZKkASAAAAAElFTkSuQmCC\n",
"text": "\u275800\u27e9"
},
{
"output_type": "display_data",
"latex": "$$\\frac{\\alpha^{2}}{\\alpha^{2} + \\beta^{2}}$$",
"png": "iVBORw0KGgoAAAANSUhEUgAAAD0AAAAtCAYAAAAdtGNyAAAABHNCSVQICAgIfAhkiAAAAl1JREFU\naIHt2jtoFEEcx/GPSRAjBnwhCGrQQEQRHyAiGNBGELFI6SMIii+iTaIWgsiJYGOTQtBGEMEyVVp7\nBUFRRDEgSMogEhQlvqLFbOJqYu68vd0psl9YbmZvmN9/bnb/O/PbYw4yL6L2eTRhAa5FjKMwdmNH\nUr6DnUWKNxUplmItupPyG3RGiqNQWrA4KQ8qeNCxZvo7xrAVrzEcKY7CacVV8X74KJwWBt6EA5Fj\nyY3mVHk/PuId3qOryECKeE73J58TQtbuE2Z4GUYK0J9Gc/UmmRjAOG7gEU6iDeuEBPY5Z/0Zacmx\n704cRHvq3HPswhPh0o5CnplzLx7jS+rcJ2H1dT9H3arkOegRfE3VF2IjXghJbH6O2rOS5z09jA5s\nxvrkuIV9WIJn+JGjfknJXGRycfIzahQlJSWNIuuGI5a5F81UjGXuZdbNsgyNZe5FNRVjmXuZdbPM\ndCxzL7qpWKS5146VEXSnUa+51/ofbbfghJDA+nAmg25msph7V2ps1yFsRSfZg9EMunXRqP13pcZ2\nx5PPVcJ+fAjbsorX6pHFcDTX4KUwyMPowQM8zUnvDwZwKVUfFO6xQ1heZ5+VGtp0+73qOopeYTe4\nuk7NKarNdKMczX6sSNW7hMGkuY23qfpEcozjXnLuOr7VqFk3Z4X7KM0FvMLSDP1Wamhz6q/6djzM\noDlFtedcLEdzk5CpJxNnGy7jWCM6r3Z5DyUB9OKDcLldxE0hs95tRBAzsAHnhIQ5hkXCzI/mpFcI\nR6p835OneKx3w7O94WgW9w9AUegQLu+SkpKSkn/xC5fPb/BMrkVFAAAAAElFTkSuQmCC\n",
"text": "2 \n \u03b1 \n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n 2 2\n\u03b1 + \u03b2"
},
{
"output_type": "display_data",
"latex": "$${\\left|11\\right\\rangle }$$",
"png": "iVBORw0KGgoAAAANSUhEUgAAAB8AAAATCAYAAABobNZCAAAABHNCSVQICAgIfAhkiAAAAOZJREFU\nSInt1TFOAkEUxvFfiLEkCIkFFkDCJTThABpqCiquYAWFtzHhBGBja0ws7KysjD2xkRYodo2w2d3Z\nRicxfs28vPle/m8mkzf8cc2KNmp78Rhnmf06ntALAMp8a5yGOpygm8bHGOABW/QLaqr4WrjOKz7K\nyTVwi1esSpqt6lvhRHLLmyLTxPfJv3Sj/ORVfRe4yiZrOcaf0GPaQBQ4vKMTC77AMBZ8iGUseBdv\nMeDnkkd3oN+CX+IuBryJDzkDJgRvpmtoNpf5xpgH6o3QTuN7vEim1hafeMY0U1PFV/ir/SuKdqio\nK05yzo7kAAAAAElFTkSuQmCC\n",
"text": "\u275811\u27e9"
},
{
"output_type": "display_data",
"latex": "$$\\frac{\\beta^{2}}{\\alpha^{2} + \\beta^{2}}$$",
"png": "iVBORw0KGgoAAAANSUhEUgAAAD0AAAAwCAYAAACi/HI3AAAABHNCSVQICAgIfAhkiAAAAnhJREFU\naIHt2U2IjVEcx/HPvBSDCXeY1BRpRAlZEQ1NZmZhg0jZSImslGRhystkJ7spZSUryoosLcZKFhLG\nZhZTSlmRt7wsGBbnmVw3M/fOfeaeI/N8N8855znP8/ufzv8559zfZQ7SlFD7FFrRjosJ44jGVuzM\nylfRG1O8OaZYGauxLyuPY22iOKLSgqVZ+SY2xhRPNdM/8A7r8RqjMcVbY4qhG/34hvnowtnIMURl\nOwbK6p/9Tus9MQOJld4lLMf9rH4AExjBW3yJFEdUDgqf0iGcxxNsShVMrJluwnesErarldgdSTsJ\n7dhV0TaIWwliQZyZ7sHDirYOIcX/W65gTVm9hMdCBiQhxj79DIfxVFixB4SF7VME7SR0oi8rd2FF\nwliisR8LUwdRSaMXspJw8ppTdKQOoGAuM+mR/UwaRUFBwWyR1/dO5V0n88xTede5dfOcyFJ510k9\n81TedW7dPDOdyrtO6pnDPFzS+N/l3TiBI9k1lu5fOY5FWXkm3vVMMqzSL7+Lk3Xq5qZPcD/eCN51\n/wyePVdjvxL2ltWXCOn8s07dGdOExbP0rqEa+zXEL6/lm2jGBXwQZnaHkNZtWCZsG41iKr/8eZ6X\n1jLoG4J7OZzVB4RBf8S9POJVaBdSGC5n10FszvviaoPeIBj1R8vaRrENj/C+Rp3Tgkk4SY/wr2U5\n1/Cyos9IRZ8ofvlJ3KloO4MXfq+e9TBUQ5+G+eXVZnrMn6tjSTgUjAmHhDZ8zRvEFDTML2+pcn9c\n2Ca2YJ3gXQ8Li9lkqk3UoduLB9Pc78QCXBcG+Qq31f45/ZMcr3L/n/TLG82x1AGkoPDLCwoKCqbj\nFwnubvhneA5lAAAAAElFTkSuQmCC\n",
"text": "2 \n \u03b2 \n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n 2 2\n\u03b1 + \u03b2"
}
],
"collapsed": false,
"prompt_number": 7,
"input": "for state, prob in measure_all(psi):\n display(state)\n display(prob)\n"
},
{
"source": "Qubits can be represented in the computational basis.",
"cell_type": "markdown"
},
{
"cell_type": "code",
"language": "python",
"outputs": [
{
"output_type": "pyout",
"latex": "$$\\left(\\begin{smallmatrix}\\alpha\\\\0\\\\0\\\\\\beta\\end{smallmatrix}\\right)$$",
"prompt_number": 8,
"text": "\u23a1\u03b1\u23a4\n\u23a2 \u23a5\n\u23a20\u23a5\n\u23a2 \u23a5\n\u23a20\u23a5\n\u23a2 \u23a5\n\u23a3\u03b2\u23a6"
}
],
"collapsed": false,
"prompt_number": 8,
"input": "represent(psi)\n"
},
{
"source": "<h2>Gates</h2>",
"cell_type": "markdown"
},
{
"source": "Gate objects are the operators which act on a quantum state.",
"cell_type": "markdown"
},
{
"cell_type": "code",
"language": "python",
"outputs": [
{
"output_type": "pyout",
"latex": "$$X_{0}$$",
"prompt_number": 9,
"png": "iVBORw0KGgoAAAANSUhEUgAAABkAAAAYCAYAAAAPtVbGAAAABHNCSVQICAgIfAhkiAAAAXxJREFU\nSInl1T9IVmEUBvDf9yl8iJNDEYhGSKBgIDQIiYMOQdGom4mDIBhtIRS0O+TSoA2FELiINLTW0JCD\nEdqfRUGQQhISWiLBRR3u++HL7cLV2w0HH7hwznPO+zzvv3svZ4gFbOMwPNsYieqzUW0P71ApYtSI\nzSDUkapVsIVHaCgiHmMqmDxO8TO4/a/idVzAPr6hGriHGD2NSN5S99CNPnxEP2qYO43JSTAg2bIN\nPClbPMZ6MLpcZHA1v0UnDkI8XsQkD61YQpvkfH5IrnZpaMEryQ2DecmWDZVl0IRFXIm43mDyNqO/\ngjHcxzTu5Bk04iV6MmprkvO5muKH8TzEVXzBNRERowPv8RWfMkwWwqwnU/wUXof4QLLau+nBtxx/\npw6xixupnhf4E/V8xkSo/cb1qPcB3mRMsjBqwbQr4u7hQz05yXuSh33sBKM6mvGrTBNYxcUov4Tv\nZZusYDDKb+JZPSn0N8tAUxBdRjt+4mlJ2n+h9r+EzxGOAGtDSS7Kxo8ZAAAAAElFTkSuQmCC\n",
"text": "X \n 0"
}
],
"collapsed": false,
"prompt_number": 9,
"input": "g = X(0); g\n"
},
{
"cell_type": "code",
"language": "python",
"outputs": [
{
"output_type": "pyout",
"latex": "$$\\left(\\begin{smallmatrix}0 & 1 & 0 & 0\\\\1 & 0 & 0 & 0\\\\0 & 0 & 0 & 1\\\\0 & 0 & 1 & 0\\end{smallmatrix}\\right)$$",
"prompt_number": 10,
"text": "\u23a10 1 0 0\u23a4\n\u23a2 \u23a5\n\u23a21 0 0 0\u23a5\n\u23a2 \u23a5\n\u23a20 0 0 1\u23a5\n\u23a2 \u23a5\n\u23a30 0 1 0\u23a6"
}
],
"collapsed": false,
"prompt_number": 10,
"input": "represent(g, nqubits=2)\n"
},
{
"cell_type": "code",
"language": "python",
"outputs": [
{
"output_type": "pyout",
"latex": "$$H_{0} {\\left|00\\right\\rangle }$$",
"prompt_number": 11,
"png": "iVBORw0KGgoAAAANSUhEUgAAADYAAAAZCAYAAAB6v90+AAAABHNCSVQICAgIfAhkiAAAArlJREFU\nWIXt1juIlUcUB/Df+mDBF76SrIWKkCDYCEZBWKNRQRvFUkQbQSSYWFioSEAuiIWNxErQRgsxnSls\nRDEmJgSx8YGoGBUM0RXBF1po1E0xM+53v71z937XlbXYf3O+c85/vjln5pyZYRifLDZjUqvkE7iB\nXvyHSzgcfTPxK/6N/ue4iO+b/G9HA9smHMde7MOazNiBeF0DzN0PC4XAD2T8u6J/bQv/qpX0DbiN\n8VH/DD1Y1iZvTwsxvMd2IfCVGf8pvNVaGdQK3x24Jqx+EUeFKuioyCMkWk42i5N4jbENfKPxQijR\nVlArfK8SFqwcyLpon1eRl1C3ayMygYxAt9A7Lxv4FwgJ/54Z3wxfR3mrZP87ym8r8hIeCv2GfGJz\nMRHnMv6lUf6W8TdDmvxFyZ4WcFpFXsIxrE/KqMzki6NcoW/lipgfZTs7lgIuV0LSJ1bkJTzBlKTk\nElsiHAxL9V+xUXiG63iUGd8Mr6J8V7KPLtlb5SVMEpJD41LswDe4rH9ShKYdo73dgqsZezqkHlTk\nJawXyhGNE5uDqTif+fGiKNvpL7gSZfmaGBdlT0VewjTcT0qjUkz99UcmsO4oizs2EhvRiRk4g9OZ\n8Sng6epLeUGUVyvyCFfC2cx87/GzcE90Zfw9+o7chI34KX6PxE18VfDXSvyn+LFkO4m/2uTtUX9h\n90OnEPjtjH+ukPSRkv26+ov0EHYX9FqJ/x3+wYSozxL6eVUbvC/wQyZeM4XSuqvv4fsntkT/amGV\nHkX/Y6HHuoU+fYPZpUROFPRtDebcil+wX9iFDZnYBuJtxuRcYh+CKUKy0wu2nVqo+Y+J3MujCh4L\n91pvwTY22ocMg5FYr/AY/rxg68K9Qfh32xiMxOCC+sNjuXCADBmaHpEVMB4HhUfzl7hjiBMbbHQO\ndQDDGMYnhv8BbkWjYKG8VMEAAAAASUVORK5CYII=\n",
"text": "H \u22c5\u275800\u27e9\n 0"
}
],
"collapsed": false,
"prompt_number": 11,
"input": "c = H(0)*Qubit('00'); c\n"
},
{
"cell_type": "code",
"language": "python",
"outputs": [
{
"output_type": "pyout",
"latex": "$$\\frac{1}{2} \\sqrt{2} {\\left|00\\right\\rangle } + \\frac{1}{2} \\sqrt{2} {\\left|01\\right\\rangle }$$",
"prompt_number": 12,
"png": "iVBORw0KGgoAAAANSUhEUgAAALwAAAAkCAYAAAAzfFCFAAAABHNCSVQICAgIfAhkiAAABX9JREFU\neJzt21uoJMUdx/HPWU/0eIm3RD0mG/XB1RXcXYISdb2dJBJQvIKyURTD5niLMYiC98sqJupDoiEv\nkSREUAgRJUFFTUQwIYGIi6BkRfAhLPGKRlRWIlE5efjPsD19eqanZ6Z75hzrC80w1f+uqq5fdVX9\n/9VNIpFIJJYnU+OuQAkLI8hj0u9xqfJVvDaCfCZWnwMx03CZD2PvhstciiRt+mRFHzYrcR42Y7be\n6nTwdWzFew2WudRI2tTAyVgnlhcHNVjug2LaTHQnaVOR6T5snqy9Fos5BB/h9TGUvZRI2tRIk6PI\nr7CqobKWA0mbPulnDd80XxMO2KvjrkgJF467AmNgqWhDF336WdI0zdX4aY/zazEvHLbn8Si2FNit\na/2+mEu/AN8QDtebeATvFFxfZvcFER3Z2qOuy40ybWhOnzbH4QT8JJc+tD5NTJv7iHBXN07HH3GE\niErcif/ijALbudaR5Wb8DTu2/n9PNPjOA9jthmt71LVJJkEbmtOHiN+fhA/x64LzQ+mzo2jUQwfN\noE/uwPFdzu2Kf2KvXPpT+FQ8zVnmdDboHvgAGzJpK/Au7hnADm4RI0lVdjG6uPkkaENz+sCVeFZE\nixYUd3gG1OdC3Cee3N+2CquD3fFYj/MniJ29Dbn0S8VNz+fS53Q26HWi4fObJb/TGXHo1w7WFNSn\nHzbi3AGuyzMp2tCcPlmm9e7wg+ozEq4RU1Y3rsUpPc5/U9zcX3Ppp7bS782lz+ls0D/jX13KXcBh\nFe3a/LhHnbsxj/MHuK4uhtWG5vTJUtbhyenTRJRmGpuEk/IDxVPMjGiwJ3rk8yxOs9j7Prj1m3d+\n8sxiW0H6R63fAyvatXlZs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d\u23bd\u23bd \u23bd\u23bd\u23bd \n\u2572\u2571 2 \u22c5\u275800\u27e9 \u2572\u2571 2 \u22c5\u275801\u27e9\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 + \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n 2 2"
}
],
"collapsed": false,
"prompt_number": 12,
"input": "qapply(c)\n"
},
{
"cell_type": "code",
"language": "python",
"outputs": [
{
"output_type": "display_data",
"latex": "$$H_{0} {\\left|0\\right\\rangle } = \\frac{1}{2} \\sqrt{2} {\\left|0\\right\\rangle } + \\frac{1}{2} \\sqrt{2} {\\left|1\\right\\rangle }$$",
"png": "iVBORw0KGgoAAAANSUhEUgAAAOgAAAAkCAYAAACDg3a3AAAABHNCSVQICAgIfAhkiAAABt5JREFU\neJztnVmMFEUYx3+zFwRXDlejiAgoahRcEggCLh6Aig9GRYkQHlDjAyiaeIIahQExhggaRXGJYKKi\ngCgYjYrGYzmMxgMBgwkGEQQEA4gYUZDLh6/a7enump7u7enunalfMunuqq5j/ttV9dVX1bNgMBgM\nBoPBUEr0BI5H8DEEI1W6V0SVUYlzXszlNQA3A5kIPq0Zo7tBSxtgIPA6MC/mspcAJ8dcZlowutsw\nI6ieLkB7YF/M5fYBdgB7Yi43LRjdDYGYTrw9+StA1xjLSytGd8wImjZ6AoeAbUlXpMxIre5pbqCj\nkPlIOfEAMDPhOhjd40erua6BLgO+Btaqz7fAiyquG/CZCrPivwIm5KnAWI+wQcDzwOPAfcD5jvh1\nwMg8eZYaXYATgI2a+CrgLuAN4AVgNFDtk6fR3Z+4dK8GXkXm105CaT4AWc9ZhHdDnqji7y4gr6zj\neiiwE2nsAL2AXbjd6tMLrGsxiWsu9BTQVxNXA3wIjEP+wEOAn4HlyMOlI+u4Nrq7iUP3OuAtpL3o\nvMSemuczcfup4xLgmEf8AFt8UCYDbwNb1fUG4AukM7CzDqgPkX+U1FB8k68OaTRrNPH3AiuAucCf\niAUzFhhO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YEe\nuOcmk4EnEbNhF9KzjAGe8cjjKOJVm4Ds0ADogHjVHqJ511It4tDJZ+sfp3W9v9eIfMeZiDlTKJ2Q\nHUALyN2zWY08QIU4O6LUvbWRpO4WlrXh1fH5at4ZeBZ4XxW6H9lQbTkVGpA/7hoVvxFpfH1U/EFy\nv/hjyOZii8kelZ2PbIOagPS6s8jtMG7DvTYXNyOBR5DvOjyiPBcizoYgfID+t28W50mXhO5NLUhr\nUSq61wBPq7IPqXQ/IFbq9bb7tZpbQ3QN3j3LLvXppMlgk0q7V8VbXt9JiNk7TF23Q8wrJxXI5H07\n8K8jrj2y/zEpxiBLTMuBU5HOaSKyr7Il1CEL3EHmLoPQ70vdjn7LZRK6NyFWWFhKSfcK9PtrdyO/\n4ABFftargH+AM2xhU4B3ilVgTCwjdwRqBD5NqC6tiZbuxTW629CtgwbhCOIh7Ij0KiBvNOzQpmgd\nPEeuK74t7k0OBjc3tTC90b0INJLrWl9Py8yctFGHmPGXJF2RMsPoHhE9kL2P/ZH5wpxkqxMpFYjX\n+oakK1JmGN0jpgbZqBDVC7tpYRpwsTrvkGRFygyju8GX8eT+HMijSVWkzDC6K6JwEpUq9yAvOVtb\nuzLAu8lVp2wwutsw/0NCz4W4TastNHuqDcXB6G4wGAwGg8FgMBgMBkMC/AeMQAaiqUki8QAAAABJ\nRU5ErkJggg==\n",
"text": "\u23bd\u23bd\u23bd \u23bd\u23bd\u23bd \n \u2572\u2571 2 \u22c5\u27580\u27e9 \u2572\u2571 2 \u22c5\u27581\u27e9\nH \u22c5\u27580\u27e9 = \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 + \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n 0 2 2"
},
{
"output_type": "display_data",
"latex": "$$H_{0} {\\left|1\\right\\rangle } = \\frac{1}{2} \\sqrt{2} {\\left|0\\right\\rangle } - \\frac{1}{2} \\sqrt{2} {\\left|1\\right\\rangle }$$",
"png": "iVBORw0KGgoAAAANS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DYWzXiPwQUJtySpWYxdBvWN+HAG+RBa9u1VaD1rWIJXKAgpd4p0oDhiwtA2rcRlopDASZhviCMoK\nPRGTTv8iriU6rMYR0Q+JDxyK2PwLk21OpLRDvMcTkm5IhrEaR0w1sunfI+mGRMws4AL1vluSDckw\nVmNLSaZQ+EvXDybVkAxjNVZE4cDJKlORH2xyQqJywJvJNSeTWI1d2P8TYOZcik2mXbR4jC1tx2ps\nsVgsFovFYrFYLBZLAP4DNMrlCCBIL0wAAAAASUVORK5CYII=\n",
"text": "\u23bd\u23bd\u23bd \u23bd\u23bd\u23bd \n \u2572\u2571 2 \u22c5\u27580\u27e9 \u2572\u2571 2 \u22c5\u27581\u27e9\nH \u22c5\u27581\u27e9 = \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 - \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n 0 2 2"
},
{
"output_type": "display_data",
"latex": "$$X_{0} {\\left|0\\right\\rangle } = {\\left|1\\right\\rangle }$$",
"png": "iVBORw0KGgoAAAANSUhEUgAAAFQAAAAZCAYAAACvrQlzAAAABHNCSVQICAgIfAhkiAAAA0BJREFU\naIHt2EuIHEUcx/HPJpFlSQyKUbIs6iFKDBjwgZfgQTwoERUxqPhWVokmJ9EEEpDMQRRfCAqiogjB\nHBRBDd4UFFFQwefiQQ1kTQIRRQ+aRFbUzaGq2e6anp7p7Vl3decLQ3X9q/pfv/lPPf41DFg03IKx\n+RZRQS19e3AI0/FzKDrIeDbXdgzvY6jC3/YS2414DQ/jUdyQtK/Etl4FN6RMX8YmIR4ptfUtwz4h\naGuStiHsx04s7cFXK6lficM4JSduEteUvLesR71NaJXYxrAFf+L1ivcK+pZUDPIXXojPNyVtT2Cr\nMLv+rpRazk7sxS+x/hvewssYzvXbi6tm4b8pd+MxrMA/Ff1q6zsVU/jBTPB34LaaAlu554uFWX9t\n0mdjtF+a2B+qOdZsaFW0HdF5hpLoq5qh8DPewBm4AuPCzN3dVWJnLozl94l9XywvKbGf1WC8uaag\nr1tA4flYPol1eLyhgNWxPJLYj8ZyNLG/qv3AWkgU9PWy4b+Hb7EWz/RBQBbQo4k9q5+U2P/A8g6+\n1gurpSrDSDmAq2v070ZBXy8BPcfMxnwXHmwoYCqW6WZ/Qgf7iCC6jAmc31BPUwr6ui35MWHTvTy+\nNK55GjPRwZ79yocT+/XCslqoFPRVBfRkYYnfi4PxpVHtuWJdvs75z7Milj8m9rX4ruGYc0lBX6fZ\nNiIcRvcLJz08hztwj/Y0Ygi340RhVn+Itzv4zgJ6uuJJf1Es8zP4AnzWwQ+cK+SudffQNGWbLd30\nIQR5N84raftC2OPOTuzX4cX4vEQI2vpceyvpP6k9W3gF3ygGZ5f5uyllVOWhbfrSJb9GmF0T+LLE\nwR7hC29J7NuFWwMh4O/i1gqRO3AnVsX6qJDYPyIk94TZfkzIe+eLlcLVepX2VVCpb6OZe/u0sMw3\nJH1eElKbrM9X2BzbfjeTsMMDeCdXv69kzHG8iaeEH2Nz0n6zsC38G6T6NuFjIQ7Z953EBzhzrvUN\nxwHX5Wxb8elcDLbQ6eWm1I0pIdWZztmW49c++P7P0Y+Awuc4LVdfLZymi45+BfQTxX+JLhPSrEVH\nnfytihEhgB8J/0z9hKf75HtRM9y9y4ABAwb8bzgOJqKj+ElYpHwAAAAASUVORK5CYII=\n",
"text": "X \u22c5\u27580\u27e9 = \u27581\u27e9\n 0"
},
{
"output_type": "display_data",
"latex": "$$X_{0} {\\left|1\\right\\rangle } = {\\left|0\\right\\rangle }$$",
"png": "iVBORw0KGgoAAAANSUhEUgAAAFQAAAAZCAYAAACvrQlzAAAABHNCSVQICAgIfAhkiAAAA0JJREFU\naIHt2FuIVVUYB/DfmHEY1CEDQ5GisDIhIQtfeooeukHRPegOJmk+RWUoRechIsjALkRFERhCQReI\n3grsoaCCrvNkGpEJRUFBZTVgMz18a5p9lvvss8/FIzXnD4e11/9b61v/+eb71l5rM8K8wc1YeaxF\nVKArfbtxEDPpdzA5mMUzBdsfeA9jFf62Vtg2YWcJP4H76gruE2X6LsHreDT9Nmb2rvUtxH4RtFWZ\nbQzfYDuOq+GrWcKdhm2YxtMV8xbW8N8vmll/PX7FKanfwBe4s2Rei74FFYscxvPp+cbMtgNb8Aj+\nriE4x/3m/oiqzH4Ll/fgv19sxx4cSP0pvIIncFJhXNf6liVn35oL/jbc2qXAZht+saiAdhkKD3e5\nVi9oFp7PFFVzVzZmndCaJ1eLvqoMhZ/wpkj9y7BBZO6uruT2h/04fYjrrRNVs69EB1xQwv+rr1NA\n4bnUPo41eKxrif3hVdwwxPWWp/b3jD+U2hUZ36Kvzoa/B3uxGk/1ILBf/IlFbWxrRbVU7cM5DuCK\nCvtsQA9l/DT+wglV+uoE9KzkDO7AgzXmDBLjQnQZJkWJDhJTqZ0usR1fwrfo61TyK8Wme3GatMFw\njjFFXC/KaliYbMM3xBHx+4xv0VcV0KWixDfjuzRpBa7sVWmPWI2vhrjel6ldmvGLU/tDxrfoa5dt\n4+JldI9408OzuF3cbF7Lxo/hNiwRWf0+3q6jvgPOxScV9rPxku730Ksr7F+L/fPkjF+f2mIGd9KH\nCPIunFNi+0zsIWdk/HV4IT0vEP/ltQV7s81anc6hDzk2N6UP8XLG7RDl3ihwR+jLS36VyK5JfF6y\n8G6RDfmhd6u4NRABfxe3tFNfwImpXVZiWyK+Exyu4WfQeABX4dTUn8A14ug4+9Kq1HepuXv7jCjz\n87MxL4pSmB1TvNv+hvMKY+/FO4X+3ZmvjfgYvxT87RMfWSbSmJscWXZHC7k+uFZcanbiDXFdLibg\nUdPXEAFZU+C2iIDNO9S5KXXClNhbZgrcIvw8AN//OQwioPCp1q8wy819qZlXGFRAP8KFhf5F4pg1\n79DN+a0K4yKAH4gvUz/iyQH5ntdodB4ywggjjPC/wT+UDKQb+BPLoQAAAABJRU5ErkJggg==\n",
"text": "X \u22c5\u27581\u27e9 = \u27580\u27e9\n 0"
},
{
"output_type": "display_data",
"latex": "$$Y_{0} {\\left|0\\right\\rangle } = \\mathb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dsjhFRs2eGeXqFIbyD48UmmqejHM2CaGnJWEe6TxIhvSMZ\n/o73xafTxDyxqZ1W4O7Fq4X+bSVzj4oofRSv4bpsfF0SuS9wgwiMMRxR4HPdG0QqmxT++BNbTa+y\neqZ7cVpkRYG7XY0cM1dQt/LYbeq3YROD6pW5cwLdlHRbTc83y/Btb+QcOOjGsR/i/EL/QnEM6qOA\nbo43g+InxmacLKL18V6Kmuso+xHeRx999NHHFP4D70iuykbrxK8AAAAASUVORK5CYII=\n",
"text": "Y \u22c5\u27580\u27e9 = \u2148\u22c5\u27581\u27e9\n 0"
},
{
"output_type": "display_data",
"latex": "$$Y_{0} {\\left|1\\right\\rangle } = - \\mathbf{\\imath} {\\left|0\\right\\rangle }$$",
"png": "iVBORw0KGgoAAAANSUhEUgAAAGUAAAAZCAYAAAAonOB1AAAABHNCSVQICAgIfAhkiAAAA51JREFU\naIHt2VuMnVMUwPHftLRiRIsaI6YoHlyelEZ4GEK9EH1wT10S0fShcYnUJUriRAjCw0iaqJBIJKQR\nIUHiEiJthIoKWiGqRFxCBMmEEdeOh7WPOWef7zuXmTntTHr+yWR/3/rWt7+19jp77bX30KNHCatw\nyJ42Yg/Q1O9T8Tb+xjjGsAn9md5h+CXp7MI2HJ7p3NrEiLW4t0A+gOubvDcbKPL7fDyL+3A/rs2e\nt+X3VWLAn2yhswVDJc8rBbLjknw8GVfE3ehrZeAMppLdn45RE+O0H7ZrDEyD33MyhefELFmB+QUf\nXoILcCa+bdPYu3CHCEgzXse5bfY5G1gnfKqO0x94BuvVp6y2/H5KDODFmfxAPI+DW7xfKZEPaj5T\n4J5Wxs1gKjXXJ4j0vjrTWSbG4NJMXud3PlOIoMAVNbK52IDbxJrSLb7DEV3sf3exVKSkzzP5ztSe\nlcnr/C4Kymv4CefhoCR7EI9hx9RsbcnTWNnlb0yVo8TC/RLOKdEZTO1vmXwstXlxVOf3PgUd/iNy\n3xqRwubhE7zZrtVTYNTEDyHnFDyus2Jgp8Y0PBX6RLa4ObXr8EaBXjUoY5n8LzG+CzN5nd9FQSFS\n2Jr00Y24vQPDp8ICYWAR7+Pk3WRHGSvwMn7Hco3pqcqfqd2VyfvEUpDL6/wuC8qW1PHPonLaXawU\nU3mm8hG+xvE4Q/xoi9heIt9fBOb7TF7nd1lQThQl8Ssao9pNhvBNl7/xME7rQP86bE3XX6V2tVhf\nN5W8sy21eSo+ILU/ZPI6v8uCMpzaoo/OwTViM7RYrDWvlvTTCcPY3OT5Ujyq8zXl8kx2Y4d25czH\n1Xgg3R+LLzKdHWJfshjv1MiXpbZ2JrXy+382iiOX/JiF2NGvT9dz8amYzlUqJX222qfMlh39RWKx\nHsAiE/5WMr2teCKTjYjN5LwaWcsdPTHQw/hQY/VAnPG8kK7/FTOlnTK2uukcKHi2SKxfrXb9M4Eh\nfIwfxazbUKJ3Jy7Bkel+IS7EQ6IKow2/jxbT6Muk9CvewpU1On2iADgp+/iLNfc3Zf3egPdEdTGe\n/j4Twdw36axKBs4GDhV7uRGx2FfJ/YbLxCnISGpvUT8rpsXvBWJQl9TI1mozJ/Zoj6L01YxRE0f3\nVfp19+hlr6PToMAH6teFQVG795gmJhOUd3F2zf1yUar2mCYmU4L2i4pjM44Rs+SR6TSqx+Qp+idY\njx49evTYe/kP0yK1Sgfn/IEAAAAASUVORK5CYII=\n",
"text": "Y \u22c5\u27581\u27e9 = -\u2148\u22c5\u27580\u27e9\n 0"
},
{
"output_type": "display_data",
"latex": "$$Z_{0} {\\left|0\\right\\rangle } = {\\left|0\\right\\rangle }$$",
"png": "iVBORw0KGgoAAAANSUhEUgAAAFEAAAAZCAYAAABJhMI3AAAABHNCSVQICAgIfAhkiAAAAvlJREFU\nWIXt2F2IVkUcx/HPo65LWppS65ZFWUFXiRGiJKYI1RIlQlem+dabC4IXQnkRqEghXqkZXob2RkFQ\nRCFIEXXpnVJGhm+wrVEp+BYq7nYxs3WaznN2z3OedVOfLzzMmd+c88yPmf/M+c+hxXVHNyaMtIkC\nSvnrwCX04zIOYx/2xt8fse3ZOs+Pxroc/RV8iDewFc8k7VOxeqgmK3BV/K3ERaxFW9K2CFewo+D5\nMXg90VbgJ4yP9Q78innJfZuHarICV8XfJ3g6R5+FC/gMo0qYHIUfhRnO8j6Oo5bRnsBjQzXaIMPu\nbyy+ydHvE2ZmP8aVNLlIWP5p589HfXpGqxn+aGyqv7xo6vTfGZmML/GnEKEXSpp+JJaHE/3nWM7P\naP34DbeX7KMKlfzlDeIJ4SUyQDs+xRQ8JURjWTpjeS7Rz8fyjkT/AEsb6KdRKvkbM8if1/AOZqML\nPzTm8W+T5xN9oH5rov+ufiTOxVsl+z+AZQXtlfwNNohvYjGW4+tB7i3iYiz7Er2tjn6bkEbl8R1m\nVPCSRyV/RW/Yl7EeG7Eno9+EBSVNHqyjD6QTvYm+BO+V7KMKlfzVG8QuvI3d2JS0LcbEch4diOWk\nRL85liczWk1YKo3svY1SyV/ecp6Bj/EtXsppX4UnhVBfJWT/0/CF/NQoa/JunM7oM2OZjYTH/fvF\nljIH2wva8zgoHCDq0Ux/7kIPvpcfbc/h83jdjS3xuk1IB+6N9TQPq+EsXkv+b6+wx2UZiRNL0/xN\nEGakF/ckbXcK+2MfXozaUTyauWcPXq1jEtbgGG6J9QeEfLMr6ae7yGSTaKq/7HLehoeESPwoamNx\nv3++XFwWIrFdiLqezPO/4OF43YczSV87Y3/v4ggexAvCbA+wUPgAMNz8L/xNFTL3bC63QTjV3HAU\npThFnBSOgP0ZbTxOVXZ0DdLoIF4R9s+OjNYpHBlblGC7sBkT3m4nhC89Nxy1wW+py0TswlfCJnxI\nOGe3aID2kTbQokWLFk3iL4dftLkOERIkAAAAAElFTkSuQmCC\n",
"text": "Z \u22c5\u27580\u27e9 = \u27580\u27e9\n 0"
},
{
"output_type": "display_data",
"latex": "$$Z_{0} {\\left|1\\right\\rangle } = - {\\left|1\\right\\rangle }$$",
"png": "iVBORw0KGgoAAAANSUhEUgAAAGEAAAAZCAYAAAAhd0APAAAABHNCSVQICAgIfAhkiAA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"output_type": "display_data",
"latex": "$$S_{0} {\\left|0\\right\\rangle } = {\\left|0\\right\\rangle }$$",
"png": "iVBORw0KGgoAAAANSUhEUgAAAFAAAAAZCAYAAACmRqkJAAAABHNCSVQICAgIfAhkiAAAAxFJREFU\nWIXt2FuIVVUcx/HPNGMoE1qBNRoRGpHVQ/SgFYSXwEKofCmwgp566iVIiMKgE1pEShAEPgiCqFTY\ng1BgF3opCO3Bl6HQLkxRjEk3jSYvXcaH/z7MdrX39uyzz2gj5wuHfdZ/3X5n7bX+//869LloWIDH\nLrSICgr1DVV0GMITWJZ9n4138Cbewn0VfZ/GK4ntFryAMZzAaWzByaz+CG44x4/oFdOubw7exXO4\nJGd/FofFIlbRSsrzcAz35Gy7sC1ptxZLOxXZgFZS7rm+PQWd24zj8ZoCN+CHxLYak7g7ZxsUu2C6\naSXlrvXld1ebeWKl95RMPoqPOhQKl+JJfJDYP8afznYF/+B3XF5j/KY00le0gHdhlvLz/onwE51y\nLebjq8R+Srz1lYn9DTxSY/ymNNJXFEQOiJV+FYuwN7P9ldVvqilwJHv+UVA3IaJbnnEsrDlHExrp\nK1rAn0Ww2IT12WcCO4SvONalwIkSgUXH9UvcKAJWyodix3TKJB7C19OhryyN2SxSloexCneIlOZq\nPNiR7ClOZc9/C+pmldiXYGfJeKtrzn8uGukr8oFtDuF5LMdt+F4El9k1BY5W1A2L/CrPAnFMJmvO\n0y2N9KUL+EzJQJ9jd9ZpoKbA73AcVxTUXYYfE9uj2Vzni0b6hpLGK/FyyURzcVBk6XAnVojgMgcv\nKt81oyLa5ZmP6/BezjaYzfNbyTiwT30fuA7fVLTpib41+BvXF9RdhaPCH8KVwsG3X8AWcT1q00r6\nv44vEts6Ee3z6dID4uo43bSSck/0bRa50Nu4OWdfjP0iGrfZgO258nIRmcoELsJPuD8rD+B9/70S\nbiwT12NaSblrffkjPILbcSteE+H7F3Fkn8KnubZL8G2uPC7e1LAI/ceTecZERr9e7PS54kjld+2I\n6mPWSy64vn0iV2xzjfA15zMB/l9QlcZUMebsgDGcPX9tJmfm0e0CHhSBpc2I8CEni5tfvHS7gJ+Z\nishwL7Y2lzPzGOyy31Hxt9ca3CR24EumrkV9OmRA/J/Wp0+fPjORMyCOwRiXS9e4AAAAAElFTkSu\nQmCC\n",
"text": "S \u22c5\u27580\u27e9 = \u27580\u27e9\n 0"
},
{
"output_type": "display_data",
"latex": "$$S_{0} {\\left|1\\right\\rangle } = \\mathbf{\\imath} {\\left|1\\right\\rangle }$$",
"png": "iVBORw0KGgoAAAANSUhEUgAAAFYAAAAZCAYAAACrWNlOAAAABHNCSVQICAgIfAhkiAAAAwpJREFU\naIHt2F+oVFUUx/GPXpO8lkWQXdMHKSUzTXxQKqK8QYWQ/6CHNIggS+ohEEHqSSH7Z9JbCEGiqdSb\nkcINTLwgIlqYIEIFpiIUWmlEUFF5e1jnNmemc840M+coXecLw72z99pr/WbtffZe+9BlxDMJT11p\nEW2QqXt0wYAxeBE78CE+wjMYjz1Ngq0t6LsbRzLav8P0Jn6rpjTdeYkdJxI5QczGE1iKiTiKX5oI\n7M1ouxHL8GniJ4vPMa+J7yopTXdeYt8XM7EBl1Ltr+P6JEgrLMB7mIMLBXZ78FiLvqtkgTZ1j8kw\nugFLGg1THMe+FgUOJh9C7NQcu7/ws1glP7UYowoGtak7a8Xej2vk73cHcKodlf+RD7CiQv9VUac7\nK7GHxQy8jU1qiR5mQ5Xq8C1urTjGLLyFAfGYl0Gd7qzE/oCXk//XiBV6Ee+IpX45+Bp35PTtxbEW\nPl9gWmp8L1aJ33heVD6l687aY4nZ3I3l6Mc9eAG34PESheQxA9tz+h7u0PezeFccyv3Y0qG/NP/o\nLqpjv8Q6PIC5OCsOtWtLFJLFJPFYDVXkf7c4gB/BFGwtyW+d7sbEvpQz6AR2JoNGlSQkjyeTWFXx\nTfL3OVE2ni7Jb53u9FZwnSgp3sgZOEFcDn5Nvt+LB/GHuFC8qvNV1pPEuVhgM4CbW/A5JC44J1Nt\nfVikdorf3tDfKoW6F+LPJEgjE3FO7ElwE75Sm5hN6q+D6wtEDMpfJYsxv2BsWazBjxiL2eIwo0Td\n6a3gIVGfvomZqfbb8DE2Yn/S9jwOiomQ9K8sEDVMj7iA9Ip3Do3Mk30fL5spotq5JN5/bGti35Hu\n7WIl9ouS5jN8gl24L8P2ldT3aeKRGw66usF+dvJDziR2Q+IJOKR2yvfh6TxxJTND3B434q5U+xXX\nPaBW68LkJGjVhf3/hqJyq4hT6g+q4ZVa9KLiqqLdxB5V/wqtD9/jt44VjRDaTewRtQoBHsXmzuWM\nHHraHHdOnJILcadYsa/h95J0XfWMErVgly5dunT5N38DiqamQGdaPfcAAAAASUVORK5CYII=\n",
"text": "S \u22c5\u27581\u27e9 = \u2148\u22c5\u27581\u27e9\n 0"
},
{
"output_type": "display_data",
"latex": "$$T_{0} {\\left|0\\right\\rangle } = {\\left|0\\right\\rangle }$$",
"png": "iVBORw0KGgoAAAANSUhEUgAAAE8AAAAZCAYAAABw43NsAAAABHNCSVQICAgIfAhkiAAAAvNJREFU\nWIXt2E2IVlUcx/GPo43ju7YQqzFxFEJFMiVcREPUMnQr6SbSQDAGhISWLhRFaKeQEGRQiREVLSp7\nWfi20ZBSCEILq0ldpClWvqYtzr1xPN77zB3vHYex57s55/7uvf/ze849L//z0GbE04dxw22iBYX+\nRkX1hfguq/+AnzEVS3EDh3AFU/A4ujANF6MY47Aa25M2+vAkTqETX+GL6Jm5eApv38UPGwxD5m8z\nPsCkSFuAW9iVPLsQFwpiTMSrifYKjgmdDd04l5mN2VRmrEEa9dcR1ZfgBVyKtN6s/DJ577gwEgfi\nAWzAbmHUQj8OuvMrHsXiCjGbpJa/vPOewAFcT17IO29/oo/G7xXMrcCj2Jvon2MeeiLtEyyvELNJ\navnLO2863ioI3iusA78meic+rWBuSVaeSPSTWflMpN3A35hcIW5T1PKXd95enE4CzMXD7hx1cBl7\nKpibkZV/JXp+/VCiv4dVFeI2RS1/Y1oEzqfsvru2Fsxdxs0Sc1MTvR8zS2I9h9cH2f4RvDxU/qp0\nXtHIq8rVAmOEhVrBvW7BYBFfY1ENL0XU8tehnF5hKp9s8cxAHC/RJ2TlmURfKUyNe0Utf2Wd143Z\nwg5ch2MYL2wwMROz8mykjRFMF+WPQ0Utf2XTttWUHYuXhMy8Bx8LeVGZuVHCx/gp0vMENP7yy4R0\noIxnsa3F/SK+wdoW95v09x9vCCeLBQX31mNjVu/KGn0ku04z+E5cw7okxkF8lmjDccJo3N94/Ig/\n3H72zTnj9kz7feFsWGQOXsP3WVzCB7mGp6Nn5uDFKuZq0qi/fNp24CPhXNuDWZl+WJjjbwp53RRh\ne/8tinFaOKHAP/gzaWOrMIrfFRLux4TMPl5Pn8/aGGqG1d+crKH4z4Mt+LBu4JFIq1SliH7h/Hsr\n0ibgfGOORhCD7byrwvowPdJm4JfGHN3n7MSarD5aWPPKjlT3NUW76UA8iB3Cf3zz8S3eadLU/4Gx\nw22gTZs2bQbJv2c0thLwHEogAAAAAElFTkSuQmCC\n",
"text": "T \u22c5\u27580\u27e9 = \u27580\u27e9\n 0"
},
{
"output_type": "display_data",
"latex": "$$T_{0} {\\left|1\\right\\rangle } = e^{\\frac{1}{4} \\mathbf{\\imath} \\pi} {\\left|1\\right\\rangle }$$",
"png": "iVBORw0KGgoAAAANSUhEUgAAAHgAAAAlCAYAAACJdC37AAAABHNCSVQICAgIfAhkiAAABFZJREFU\neJzt2nuoFHUUwPGP3u2ppvmosJCLFFmYWNGL8hFlYRFlJIlRiAQKFZVESUUY9oaQ6J8C/UfsXaRF\nkAQRFoRID+hBZEaRPS0yzbKbZn+cWe64d2bv7r27d/de5gvDzP7mzG/OnDO/3znnN0tBQYE1rVag\noDl04FZ81WpFCprLO61WoK8Mb7UCBc2lcPAQp3DwEKdw8BCno9UKDAJuxtUYhc+xp7XqFBSkGNZq\nBYYgJVyGiXgKnbgFx1fI7cdi/DOQyrWKa7XPy3agn9t1GIOPMQmrMAOPY3pqP6XBemfasJQ6nojn\nReJ1QMSaw3BIcr4r2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WMTLWtEgvrBW1IvX+624WvxRtW5miNyaILmkBf/lX5Ic5I/Z6FlxujTkE7ME2s6JwqPmM90Vp1\nCprBKFFKjetFrqCgoKCgoKCgoGDo8T+sAvYh0KrrKgAAAABJRU5ErkJggg==\n",
"text": "\u2148\u22c5\u03c0 \n \u2500\u2500\u2500 \n 4 \nT \u22c5\u27581\u27e9 = \u212f \u22c5\u27581\u27e9\n 0"
}
],
"collapsed": false,
"prompt_number": 13,
"input": "for gate in [H,X,Y,Z,S,T]:\n for state in [Qubit('0'),Qubit('1')]:\n lhs = gate(0)*state\n rhs = qapply(lhs)\n display(Eq(lhs,rhs))"
},
{
"source": "<h2>Symbolic gate rules and circuit simplification</h2>",
"cell_type": "markdown"
},
{
"cell_type": "code",
"language": "python",
"outputs": [
{
"output_type": "display_data",
"latex": "$$\\left[Y_{0},Z_{0}\\right] = 2 \\mathbf{\\imath} X_{0}$$",
"png": "iVBORw0KGgoAAAANSUhEUgAAAHYAAAAZCAYAAADkBdqeAAAABHNCSVQICAgIfAhkiAAABSZJREFU\naIHt2XnsXFMUB/DPb0FpiQpR0kYpiYoqGgSNoJbiD2JfSqwVqVgihEotsaRiiVDUEmIXaxDRWCcR\n4RdibdIosdZSFRJ7tc3PH+eNvnm/N/PmTec3kvb3TV5m7jnv3nPfuffcs1yGsFqiK9N+AmPwJU7H\nhhn+3/gpQxuGjVPtf/BjC3MZieEF7/yBX+rwevAmevEyLmlhDq1iffzWYt/h4tvTWIolyf+sfiW8\npWWEVFL/T8SLWIF+zMdlOX2mio/qx9eYU0ZgCl8kY/yMt/EQ7kme+QnvqibG2RZzW5xDWUxHH57D\nx7gN65Yc42g8LwyiXxjFDSn+/liU8H7BK5hUdqKVHNrcZNCTG/R7HDPLCkthApbjcnRneLsIS31e\nWGUROrWwZ+FmK+c0CovxhrDgspgp9DwrhzcH9yk+0eqikkPbKxH4Up0+M3BGqwITzMRFOfSx+AHv\nav6jOrGw3fjMwAU8U7ER1MMoLMPnal3kUbiihfF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Bs3KGmwsEBbXDD7FMRnabgV9HkueeijUQzNlriIsNPBe\nd4Tae9v91O7iwZS1JqBQD+1Y2PliB6UxWjjzKiZpvAPbKWtNQKEe2rGwy4Rf3CNpTxAXwulyYDtu\ngJqVtSagUA9ZH7tEFPq/xJElBE0TBYwdRAAxzcqbjnajnqweEWT0qJ+WrU7opM6HMIQhDGEIQxhC\ngn8B8whCyP5F+H8AAAAASUVORK5CYII=\n",
"text": "\u23a1Y ,Z \u23a4 = 2\u22c5\u2148\u22c5X \n\u23a3 0 0\u23a6 0"
},
{
"output_type": "display_data",
"latex": "$$- \\left[H_{0},Y_{0}\\right] = - \\sqrt{2} \\mathbf{\\imath} \\left(- X_{0} + Z_{0}\\right)$$",
"png": "iVBORw0KGgoAAAANSUhEUgAAAPQAAAAhCAYAAADu3IZiAAAABHNCSVQICAgIfAhkiAAACNtJREFU\neJztnHtwXUUdxz9J+rjUpJQUnJRKO1IZUWlBoI6o1LYCLYIUKtKKr0JBHMeiYnmoKKgUR9CBsYyF\niAVlmIjGIkJ5OCixBeuzgKDURy34mNJikToRijbEP757zLknZ89zT26S2c/MmXvvvs7v7O5v97e/\n3XPB4/F4PB6PxzO8eBXQ7+DyeDwNpg24o9FCeDweN1wIvL3RQng8nvKMB+5ptBAej8cNHwKWNFoI\nj8dTnhbgPvPpGWWMcVTOa4Hzzfc1wKOOym0EpwILzfdPAP9uoCxVsBToBvoaLYjHPa4UehrwInAT\n8GQk7ipgDlAzv/uBfyCHzEvAXcD+wFgT3wdsAD5eQI4LgHeHynoJuB+4KJJuKXBJ6PfDwFnm+8/N\nM1wN7MPoUugm4H3AKQlpFplrPLARWAfsrF60QkwA7gTa0bMB/Bf4GPCQ+X0v0BHK8yvgnKESMIZD\ngO8wIG8f0odg+28y6r9nA5uHXDrDQuoVJMoEJPhjqKNEOQE90FqguaQsLwM2mfJOtaRpBtajxn4d\nA5UbphsNNKOJRWjQs3G1uaYChyHH2Ta0X12Gg4AjSpaRxFGof+0GJkXi2k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pfWvkjmRexO2ZsPEHxlzCejwnbCvwBrceztHdWtpsriaT+56rd9+ZIm/cASBYZ\n51J/bh2ofg1dhs3Un1VtZ/Asvgg5DKoq31OOC5F5OZz6mat2PyM9SWHSZJyF1uKd0YzDqaKjbEbO\nmYB51J9VPhGtSf5VUfme8mxAs9P5aQmHEFftHnVsuSRJxmY0SK5EjtlKWIjs+Rtx9yL7ROTwOB5t\njXRTfwJqYkXlL0bPsY2R6xQbToxh4JDLcCCtXw0HkmRcQXWvhP6fNqTIR+DunWbQaHQ4FZ1XtZQ/\nhYFn8X+k54Zx2N/WagRV9ysX2GScEZPW4/F4PB6Px+PxeDweT07+B9vtM5c2oNiIAAAAAElFTkSu\nQmCC\n",
"text": "\u23bd\u23bd\u23bd \n-\u23a1H ,Y \u23a4 = -\u2572\u2571 2 \u22c5\u2148\u22c5\u239b- X + Z \u239e\n \u23a3 0 0\u23a6 \u239d 0 0\u23a0"
},
{
"output_type": "display_data",
"latex": "$$- \\left[Y_{0},Z_{0}\\right] = - 2 \\mathbf{\\imath} X_{0}$$",
"png": "iVBORw0KGgoAAAANSUhEUgAAAJUAAAAZCAYAAAA40GzsAAAABHNCSVQICAgIfAhkiAAABVhJREFU\naIHt2neoHFUUwOEvPmOMsUZDFBWNXVGxYRR7Q6Niw95rFIJdJPaKiooYCxKJLdiwtySIIrZYsMUS\nS+yCwS7YEo0x/nFmefMmu7Mz++bFLO4PBnbuzD3n7pkz55577tChQ8X0q0jOtrgRv+JMfIIFMvd8\ni1mZtqHonzr/Hn+2OIYFsWyB+6bjn0zbiTgES2Nj/NLiGP4LFhN2b7XvEpm2Gfgx+T1Q2CTNd/ir\nRX2l2AWjk9+DcRe+whzMxANYo06/F5J7ZuB5bNKLMRyfyJqFaXgC45Lj7uTad1gqR8YjWLIXY5hX\n9MMZeBkT8TauFC9WGY7EJPwt7DMdF6Wu7yWCwRz8gCexdi/GXYq0U9UYlgzmw5x+m2AKVq5gDBPw\nFtbMtC8gnOUPDG8io12c6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B7Q5fY\nfHxP7Ov9LJziwgb3ryY2Lmt8i3VT57eK7YcZGR1XJfeug1eSY6qoy4wXb+4junfdm+lpB7YQxd7+\n4v+kj0F6ToWXigXSUThXTGdviI38DcV0eHpG/rGiDPK1iIivC/unybVjX+VUs7FzifsHi6JbjZnm\nrpAPFwZJ6yjrEEX0zO9MFvllEabggNT5r+LTnjxqX3bkkWvHvopUZZmm5yppUfGpRY0uEale6mM9\nHYqRa8f5xane1LNYuYKYz2vsLvbwelsdb6anQzFy7Ti/ONVkkXTX2FXP3fZH5X+XVZWeDsXItWOV\nnxPfJKrnp2utEnuBmKcHiA/OrqtobEX0nIzDxMpvI+31OfF/xbx6Xh06dOjQoUOHDv9L/gUVIj0T\n0uphewAAAABJRU5ErkJggg==\n",
"text": "-\u23a1Y ,Z \u23a4 = -2\u22c5\u2148\u22c5X \n \u23a3 0 0\u23a6 0"
},
{
"output_type": "display_data",
"latex": "$$- \\left[H_{0},Z_{0}\\right] = \\sqrt{2} \\mathbf{\\imath} Y_{0}$$",
"png": "iVBORw0KGgoAAAANSUhEUgAAAJwAAAAhCAYAAAAs7MLmAAAABHNCSVQICAgIfAhkiAAABnRJREFU\neJzt23+sHUUVwPFPX0t/hVKp1YIotVhiVBR/oEasNDRRi5iIUqmSGBTRoFYLRGMNaYyxiuJvwVgV\nUWzEiBYsalrjT6piolLbQBQ1UrWRKj9sEKTa9L3nH2evd9++3bt779v77tXuN9nctzM7M2dnzsw5\nZ2YfDQ0NDQ0Nw8p8HI/xGq6+M2s6GmnoK5fhZ5gxaEEa/v+Zj28PWoiGI4f1ePmghWg4MjgKO/yP\nmdKRQQvQ0DOvwfWmydkfNp6Mzcl16oBlqYu12u80bMHVCL5j+OQqpS6BT8S/8QX8MZN3Jc7A3OR+\nHPfhJRjDt7BYmAgYxU5cWoNcZ+N9qftD+HvqfknS3ir8I1P2J/gtPiX66XAN8tTFubhZuUyLcQme\ngjvxXfygy7ZWYZMIUIjxu0eM32jquZNxg7aJfxgvx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4IfW5BuRuT/ONy8pYKYVu+3q0m7/8UTY7niC2B7fIDow/gbRXbKTOps4UCd3PlnbZk\nuSWR/yMiuuyFc4RiZ/tpc86ze0W/EJauaE/0G2KxyXuHKmNWC0UKt1Uo1JKcvJn4G35XUOdmXJ66\nvxyfS91vErN+WabcsqTe3WKWpRkRpmkcj6/YzqA2ftcI87etx/KnCbfnjWIVbl0bTN4QXyT6ZEXy\n98aCOkdEhF/kApX1ZW2kFW4mPiT8kFHtfZ91Sf4yYTK+p32Qf7UwH2luM9HRX4tfp+6vFcv+W1Np\ns4QSjottkNbXHl/Br4QzPi6UsWo7g1K41tFc0elMJxaKbY2i/114U06ZG0SfXmHy8dRyMWY7kvJ3\nJfcrMs+V9WVf9uFG8SVtxWvxQPK7X37E9ZfM/fEmBhoPmbh18nrh+J+fShsT56Rlfui9XbQzKA7j\nubi7h7KHxJ5bEXm7AueJ974/J+9u7TFLW7I/ZZ4r7ct+bfwWHfASR1y7O+S3uMfEiGquWKFajIuj\nqz2ptLHMfRXK2hkkvSgb4WP9qIdyecpG+MN1jNlQf/G7S5z9tVhk8ir4MpOjrX6001CN0r4cdoVL\nR2dn4qup+7PEIXz2w8m622mozrT15Wrx6co1eHpNdR6jfW53gTiHnZ3J72c754v32We4Pk8aZsrG\nrLb/+FmgvQO9VztAmCojYvP4AP5cU51V2zlB+0xxjyP0n1V6YLrGrKGhoaGhoaGhYZr4D0tcjwng\n5G+hAAAAAElFTkSuQmCC\n",
"text": "\u23bd\u23bd\u23bd \n-\u23a1H ,Z \u23a4 = \u2572\u2571 2 \u22c5\u2148\u22c5Y \n \u23a3 0 0\u23a6 0"
},
{
"output_type": "display_data",
"latex": "$$\\left[H_{0},Y_{0}\\right] = \\sqrt{2} \\mathbf{\\imath} \\left(- X_{0} + Z_{0}\\right)$$",
"png": "iVBORw0KGgoAAAANSUhEUgAAANQAAAAhCAYAAAChgYWyAAAABHNCSVQICAgIfAhkiAAACMJJREFU\neJztnH2QVlUdxz/sCguY4m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Bd1LkhJtgIf\nML+PRXGRH8QJgqLu/dTvRcKktQHlnpQI0F7q5IzPXYNMvfmh60vIDT055pmFwB/Nz+dSc5MvRbNx\ns+hEimabTVWuQrpxdijNpd9cCTKUHWHKv4JMRZvTUOB7XkYZt9AYL40UcCZatv+EXsqTyISpntOb\nh+IqL5r8B1EHjkJePzuQuJ7aoJtohH+ZerNzGHA5UqjqubBlSKFs0tqAcgfUqSjImSUOM4/4/xnR\nR7zbfCqaeRdR7xg6Ax1ELZpZKLi+1cj2OI3HxBYjl3IFrVIrgI/h1m+uBBnK9hhZNpife9AisZba\n39GPTqS4ythpnts50SXtoTaiUdpjpT9n7g8ih0F4f9CPBsJeaHYO8yo1c+kF5Er+Cpo5qnZsBa1M\nw6k/UdAbIV9aG2VzN+qsLP9A5RFqJ05s+tD7jeIv6JDnCOrfyf3IFB+BvKVF8QRy51epoMET5kbq\nY2IgU2s25fTbEhp12eZ1dCzsGNxknIImrJ2TVtKA2kbyRnQztQ2ozUvUjsJXGUn9pq7XpL1mlXsy\noc2sbZRJPzIHslDXORl5g8ZB8x808R1p7kXxb3Ml8VRMepH9luVr5yzv1VXGmWifupNm/T+DDehc\nVJix1HvGumicBYpuw6PPQW5Bwce+kmWBYvstz+kGF1xk3Bf5DxI/qwkKFOpZat/FTESjfrdQ/pVE\nu0KLbGMofr5RBktIOXPWYtL6bSiQJuMaHA4yBEgBFxUg0KkoljINOS/OsvKjvqkqso0VyP3sB5Qc\nIz3InT8USNONoUCSjHOAr7tUMhmdGZtSkFB7oK9Esx5qLaKN6dQ+g/coiN1VthAhWqEbgyVORtcT\nJh6Px+PxeDwej8fjSeD/M8MbLnqGlOcAAAAASUVORK5CYII=\n",
"text": "\u23bd\u23bd\u23bd \n\u23a1H ,Y \u23a4 = \u2572\u2571 2 \u22c5\u2148\u22c5\u239b- X + Z \u239e\n\u23a3 0 0\u23a6 \u239d 0 0\u23a0"
},
{
"output_type": "display_data",
"latex": "$$\\left[H_{0},Z_{0}\\right] =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qkbcukPZocdaiia1jpx9iITt/qo1xZe2/Db3uUrdQOE7Xj907hhGeZY+y3tsN09oiJ\n0tUw8fTVDq0BVmCDmDYJn22LtkNJOK61Fw771DWMPtww0qsdOmiJHbz9bNLLczK+J7ayXC42AGbp\ntcVmELpGxfOs0RjcZNCrzTuYh6NU39jYi33FjoXpA5JXV9c08TxHqbBXq2EgTGabNzQ0NDQ0NDQ0\nTAL/A1YPiWUFvKFfAAAAAElFTkSuQmCC\n",
"text": "\u23bd\u23bd\u23bd \n\u23a1H ,Z \u23a4 = -\u2572\u2571 2 \u22c5\u2148\u22c5Y \n\u23a3 0 0\u23a6 0"
}
],
"collapsed": false,
"prompt_number": 14,
"input": "for g1 in (Y,Z,H):\n for g2 in (Y,Z,H):\n e = Commutator(g1(0),g2(0))\n if g1 != g2:\n display(Eq(e,e.doit()))\n"
},
{
"cell_type": "code",
"language": "python",
"outputs": [
{
"output_type": "pyout",
"latex": "$$H_{0} X_{1} \\left(H_{0}\\right)^{2} CNOT_{0,1} X_{1} X_{0}$$",
"prompt_number": 15,
"png": "iVBORw0KGgoAAAANSUhEUgAAANwAAAAgCAYAAAB5ChbjAAAABHNCSVQICAgIfAhkiAAACJBJREFU\neJztnHmQF8UVxz/uInIYQBaMoGKiC0JihIXSErFQY7xKTFlGwAgq4hWDpeKRSkJigomlpdEYLuMd\nRCGJBDVGSWlJqryPaIJJMPFEVEoTFVcRXTw2f3x73Pn1r2emZ2fm91vX+VRNsdOv53W/mb7e6/4B\nJSUlJd2ArYARQI96V6Sk69BY7wp0Uw4DjgT6AQuBXsDjda1RSUk3ZUvgDvMvwHCgHWipW41KSrox\nA4EPgPGhtI3AqfWpTklXIsq/WAZ8wUpbC5wO7AQsALaw5HcAVyWUNwU4zkr7H3CC+Xt/4BxLfjmw\nKkGvL0XZFeYtoD/QZu6bgd7AwynruhWaFccD44A3gSXAX4EGYBYw3+SdChwbenYhsNLSdyZwYOj+\nY/Q92qx8Y4CDgWFAT+AfwArgFatuS82/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+KqcxLRP+0oica\nZT+20tpQY7krRm+S7jTcgtbQy0NpRdkVZjzRQYvO8rRHnsdy1vcm/lsTf0lR9ib83mMSRbelrPq9\n7Ew6P+fDZuBfVEZt+gOv5qA7DVcBhxIdFEmLj10taA9wcU5ldke6SvsoGi878+hwIL9jdOh+IvEz\nSxFsRv7a1dTGrkbUyc9Fa/6SaJLaR9LRss8KNesHX0MRtmHoNMKKAsoYin5t24aWcQMj8p1Eut+g\nxRFn1zkk/x6uRMS9x0OQ39cUSvP91p2lKP2J/SDTL1QtBgN7IX/huRz1Bkynck9kHdUOe8BYNNrk\nQZRdeZbxeSDqPfZF2xNr0AECSPetO0OR+ovuByUlmTmc/GexLklevk5JSWdpQP/Fw1v1rkhJyeeB\nflT6byUlJSUlJSUlJSUlJSUlXYL/A/KdqyAacZ5mAAAAAElFTkSuQmCC\n",
"text": "2 \nH \u22c5X \u22c5\u239bH \u239e \u22c5CNOT \u22c5X \u22c5X \n 0 1 \u239d 0\u23a0 0,1 1 0"
}
],
"collapsed": false,
"prompt_number": 15,
"input": "c = H(0)*X(1)*H(0)**2*CNOT(0,1)*X(1)**3*X(0)*Z(1)**2; c\n"
},
{
"cell_type": "code",
"language": "python",
"outputs": [
{
"output_type": "pyout",
"prompt_number": 16,
"text": "&lt;sympy.physics.quantum.circuitplot.CircuitPlot object at 0x48cd350&gt;"
},
{
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAACOCAYAAADKKkibAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAADjlJREFUeJzt3H1MVfUfB/D3EVepKV1EICGusqESLro+VJrGHWYhuMoy\npblqKIHocPpHPqy50uYi062NxIeWaDXjIbeGTR2BqIllCIEpIoQi5oxnwSdAuJ/fH81+Kvea3AcO\n9+v7tX3/8XvO3fu7c33fw7nnHk1EWgEMBhERKUMTEdE7BBEROVc/vQMQEZHzsdyJiBTEciciUhDL\nnYhIQSx3IiIFsdyJiBTE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+ko6IbGO5903Kl/stZ86cwZdffonTp09j7969iI6ORkhICOLj\n4xEcHKx3PCK3xXLvmx6Ycici12C5901KfqFKRPSgU+7ZMkTU+1z5mwODweCy11YZy52IHMJLJn0T\nL8sQESmI5U5EpCCWOxGRgljuREQKYrkTESmI5U5EpCCWOxGRgljuREQKYrkTESmI5U5EpCCWOxGR\ngljuREQKYrkTESmI5U5EpCCWOxGRgljuREQKYrkTESmI5U5EpCCWOxGRgljuREQKYrkTESmI5U5E\npCCWOxGRgljuREQKYrkTESmI5U5EpCCWOxGRgljuREQKYrkTESmI5U5EpCCWOxGRgljuREQKYrkT\nESmI5U5EpKD/AV6IddBhjuzWAAAAAElFTkSuQmCC\n"
}
],
"collapsed": false,
"prompt_number": 16,
"input": "circuit_plot(c, nqubits=2)"
},
{
"source": "This performs a commutator/anticommutator aware bubble sort algorithm to simplify a circuit.",
"cell_type": "markdown"
},
{
"cell_type": "code",
"language": "python",
"outputs": [
{
"output_type": "pyout",
"latex": "$$H_{0} CNOT_{0,1} X_{0}$$",
"prompt_number": 17,
"png": "iVBORw0KGgoAAAANSUhEUgAAAHwAAAAcCAYAAACj6tvkAAAABHNCSVQICAgIfAhkiAAABdBJREFU\naIHtmn/M1XMUx19XJZUk/ZCSJ0srNfkRssikYSE/VhtbTRqNUiykZGjUWqboMT8TocaDWIZEqIgo\nU37l8atFtSzL76bE9cf7fHe/9/N8vt/vvc/9Pqrd+97u7nPPOd9zzufX+Zxzvg9UUAHwIvAlkAX+\nBtYCc4xXBbwNbDb+b8Bq4Joi9DcDhgP3AyuAJcAyYKjxzwImhOTvA1YBu4F/gN4enYuBHebTz8As\nj0wP4GHgOeBR4FWgBjgmws8Rpm8nsAZ4DVhvtF+Apeb7R8C/wFcxY64vFgCbzGbW/h4e4j8Q4u1A\n85ipj6FTTMnsCP7Nxr+kHnpr0QY6A9jf6AcAdwP3An8ApznPtQXWmc2HInRfjjarO+D9gAfteXez\nXIAm6jKPviXAbSEfIbcJxnpsvxnhV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E/1hzcJ5DX0/+CXsEtSQDtEaL/hb5u/lg1D2bTn77MkB7FMLiqoE3gPcieMPQIg0M0ZqjRLIW\nRbNCUIU2j+9EQfL44xC14F1RYhpVa99oz95TH1+q0N20gdwLk5XkulmDgffRiciiu3M5cCrKA3aT\n32qcgnraYbQyJxcBH6KdW42/LdjU7P1l9jYDEz1yoKbK1AgewNnoJc3jqH6fD9xA8gnsQu6lTjDu\nncC7wOuoNITCxx8Fd8EHkeubZ812P+eZuegqCmTWoVymVF8KQhsz2jlEm4hOczmg1PHHhfTUffFl\n6cViO8qEsyFaC6OXA/am8Sf6ksaCZ9FLlPYhWgfg+xR07wvYm8af6EsaCw5qm4YThYEoWSgXxI3/\nKOp2CfeUL6m1CFui1ukyNMDvKK8Fjxt/NfpHD7f/PhglY5PQi6Fl5L8baAhfUoevji4n+MafQa8y\nXRyCwm3wKeRFVKm+FN+LTcDOlPXta/CNP4v/9WxDJ3XlvhZ7DP1Rw6qCMkHaUbSCCiqooIIKKihD\n/AdptX/0ndrekwAAAABJRU5ErkJggg==\n",
"text": "H \u22c5CNOT \u22c5X \n 0 0,1 0"
}
],
"collapsed": false,
"prompt_number": 17,
"input": "gate_simp(c)\n"
},
{
"cell_type": "code",
"language": "python",
"outputs": [
{
"output_type": "pyout",
"prompt_number": 18,
"text": "&lt;sympy.physics.quantum.circuitplot.CircuitPlot object at 0x3da1990&gt;"
},
{
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAANcAAACOCAYAAACi/J2KAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAACY1JREFUeJzt3VlIVP0fx/HPmRaXymVyayExCrWImrBFsrKIoEcqCJKW\nmzYyLaNuCivooqAdgtKKwCSKKKPCoMIss7KFNpH2RXOkIlPDp1ALx+//5l9Yzlj5+J3TjJ8XzE2/\nOYfv8fTunHEmxhCRfwH0AhF1KENExOwhiLyRxewBiLwV4yJSwriIlDAuIiWMi0gJ4yJSwriIlD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