sympy_quantum_computing.ipynb
442 lines
| 27.6 KiB
| text/plain
|
TextLexer
Fernando Perez
|
r5779 | { | |
"metadata": { | |||
"name": "sympy_quantum_computing" | |||
}, | |||
Brian Granger
|
r6035 | "nbformat": 3, | |
MinRK
|
r7739 | "nbformat_minor": 0, | |
Fernando Perez
|
r5779 | "worksheets": [ | |
{ | |||
"cells": [ | |||
{ | |||
"cell_type": "markdown", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "source": [ | |
MinRK
|
r7739 | "# Basic Symbolic Quantum Mechanics with [SymPy](http://sympy.org)\n", | |
"\n", | |||
"We first load the IPython extensions that enable LaTeX-based mathematical printing \n", | |||
Fernando Perez
|
r5779 | "of SymPy objects, and then import the quantum computing libraries from SymPy." | |
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"collapsed": true, | |||
"input": [ | |||
"%load_ext sympyprinting" | |||
], | |||
"language": "python", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "outputs": [], | |
"prompt_number": 1 | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"collapsed": true, | |||
"input": [ | |||
MinRK
|
r7739 | "from sympy import sqrt, symbols, Rational\n", | |
"from sympy import expand, Eq, Symbol, simplify, exp, sin\n", | |||
"from sympy.physics.quantum import *\n", | |||
"from sympy.physics.quantum.qubit import *\n", | |||
"from sympy.physics.quantum.gate import *\n", | |||
"from sympy.physics.quantum.grover import *\n", | |||
"from sympy.physics.quantum.qft import QFT, IQFT, Fourier\n", | |||
Fernando Perez
|
r5779 | "from sympy.physics.quantum.circuitplot import circuit_plot" | |
], | |||
"language": "python", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "outputs": [], | |
"prompt_number": 2 | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "source": [ | |
"<h2>Bras and Kets</h2>" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "source": [ | |
"Create symbolic states" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"collapsed": true, | |||
"input": [ | |||
MinRK
|
r7739 | "phi, psi = Ket('phi'), Ket('psi')\n", | |
Fernando Perez
|
r5779 | "alpha, beta = symbols('alpha beta', complex=True)" | |
], | |||
"language": "python", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "outputs": [], | |
"prompt_number": 3 | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "source": [ | |
"Create a superposition" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"collapsed": false, | |||
"input": [ | |||
"state = alpha*psi + beta*phi; state" | |||
], | |||
"language": "python", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "outputs": [ | |
{ | |||
"latex": [ | |||
"$$\\alpha {\\left|\\psi\\right\\rangle } + \\beta {\\left|\\phi\\right\\rangle }$$" | |||
], | |||
"output_type": "pyout", | |||
"png": "iVBORw0KGgoAAAANSUhEUgAAAF8AAAAXCAYAAABtR5P0AAAABHNCSVQICAgIfAhkiAAABFdJREFU\naIHt2XuIVXUQB/CPq4FZblEpYmZPLMsMUTQhDawo6LVgD4rsj6zQSCORHlD9YfTUrCxTotKUWv8p\nKAusv7YHpURlQg+ioJJ8REVtD3u6/THnsucef+fu3r27W8F+4XLOnfnNnJn5zW9m7rkM4H+L5/5t\nA/oBfeZjU4Pyh9a5flmCtgJDGrSjUYzAcmHfaqxDc8arx8eHErRS/xoNfj04BD8l6G2Y3Y92FDEd\n12EJFmOeCNbyOvWciM8S9DYl/vVn8E/PDCniBVzYoO6JenZ6RqNFBP6HHL0dk+vUNVOd/vVn8Kfh\n7QT9b7yDqQ3oXoQxPZC7BbeiI0cbhFnYXKeu8fgwQS/1rz+Dvx/+KOE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eYmE3180UpbQedMfHWugN/5IYXoM3Qecv3lrozz9T\n7hT1vR6U+ThWlJOu8F/4s2gAAxjAAOAf1RffIDO+Bi8AAAAASUVORK5CYII=\n", | |||
"prompt_number": 4, | |||
"text": [ | |||
"\u03b1\u22c5\u2758\u03c8\u27e9 + \u03b2\u22c5\u2758\u03c6\u27e9" | |||
] | |||
} | |||
], | |||
"prompt_number": 4 | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "source": [ | |
"Dagger the superposition and multiply the original" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"collapsed": false, | |||
"input": [ | |||
"ip = Dagger(state)*state; ip" | |||
], | |||
"language": "python", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "outputs": [ | |
{ | |||
"latex": [ | |||
"$$\\left(\\overline{\\alpha} {\\left\\langle \\psi\\right|} + \\overline{\\beta} {\\left\\langle \\phi\\right|}\\right) \\left(\\alpha {\\left|\\psi\\right\\rangle } + \\beta {\\left|\\phi\\right\\rangle }\\right)$$" | |||
], | |||
"output_type": "pyout", | |||
"png": "iVBORw0KGgoAAAANSUhEUgAAANoAAAAaCAYAAADR9UJvAAAABHNCSVQICAgIfAhkiAAAB/lJREFU\neJztm3uwVVMcxz/3Xo+SbgYlj1JpdOsmg6aY8WiSQXlEYhhMQ4hRyiQxHjMZKiWklISrqP7wLoq/\nNhoyyGPIY5Jo3G4NjfLI+/rjt7ezzj5rrb32Ovue22h/Zs6cc35r771+v/09e63fepwqcuKMB4YY\nyl4FHqqgLzm7CTOATq3txG7KQcACoKq1Hckpn2pL2b3AG8DWCvmSU8wW4Dvg/tZ2JKflOBN4tLWd\n0PBsazvQwsTjawt8DZzTij78H9llYnwPqM/4mg+mOHamwR5k4IcPHYFZiF/zgUVAreY41xgfMNgD\nje18YC3JKWQNMMmxfhs6H2zotJoN7FG+K94k6RWkuJZOK1t8t6DRSpc6Dg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NzGt2ItMhJjVlWuGhVjfQmpoV0F1w089XLhotWSfFNAZ5HmdE1/cN6JbJ15KZ0\nPhpZjHktJb5mYeNPz/rHUTodreNkJL3ywSXGJOLxjUIG88sTzpuGTIUf61hPGh9UXLUaTmEpwBcX\nzXz1conRhi2+Y5Glk6lpHJqNTFNmgWm/Yl8Kuw+SaJ98SFnchXT7vuhi7IqkGS6o8XVExhyuD2kt\nspuhXGz32FWrSv3x01cvU4yuWtniewTpaXNycnJycnJycnJycnJ2Uf4FjIcqrwyQNUcAAAAASUVO\nRK5CYII=\n", | |||
"prompt_number": 5, | |||
"text": [ | |||
MinRK
|
r7739 | "\n", | |
"\u239b_ _ \u239e \n", | |||
Fernando Perez
|
r5779 | "\u239d\u03b1\u22c5\u27e8\u03c8\u2758 + \u03b2\u22c5\u27e8\u03c6\u2758\u23a0\u22c5(\u03b1\u22c5\u2758\u03c8\u27e9 + \u03b2\u22c5\u2758\u03c6\u27e9)" | |
] | |||
} | |||
], | |||
"prompt_number": 5 | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "source": [ | |
"Distribute" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"collapsed": false, | |||
"input": [ | |||
"qapply(expand(ip))" | |||
], | |||
"language": "python", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "outputs": [ | |
{ | |||
"latex": [ | |||
"$$\\alpha \\overline{\\alpha} \\left\\langle \\psi \\right. {\\left|\\psi\\right\\rangle } + \\alpha \\overline{\\beta} \\left\\langle \\phi \\right. {\\left|\\psi\\right\\rangle } + \\beta \\overline{\\alpha} \\left\\langle \\psi \\right. {\\left|\\phi\\right\\rangle } + \\beta \\overline{\\beta} \\left\\langle \\phi \\right. {\\left|\\phi\\right\\rangle }$$" | |||
], | |||
"output_type": "pyout", | |||
"png": "iVBORw0KGgoAAAANSUhEUgAAAU8AAAAaCAYAAAA3+d4CA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3vKW2oOL+EzO8tR26RTqHGZjrdr7JUqjJjE15V9bFNP7n0sAljU/8W6d2qc22oEdSe\ncqp0C/WfmkUKcspzO9LJtmrDbL7IRI9Y1mvEeREwUiNP0GC7C8Zt6PO15WUqVz7W7SeXHjZhbNMf\nLrybiWtZ/565F1k7l5yIjyv5FMxWOnmakBHw/QztdKB/1Wai47H/JZ5GnEcCX1rmjssFY12+WXiZ\nypWPdfrJpYdNGNv2hwvvZuJa5u95bkK9Fi259qqe/qmzTTfPLGrLSmy1iO7LUfLQBchtpK10ODdS\nFRjr8s3Ky1QufVxPLj1swjhLf7jybj0puZZ58gxQ386MQZ6K6Wh2nW26eVqp7i95n0u2X+IJSOc8\nDP3fQOxJjLPyMlVAsT7W7adW3HnYhHGW/ggozrtV5Orl5eXl5eXl5eXl5eXl5eXl5eXlVZr+A0vn\ncOsl0kmXAAAAAElFTkSuQmCC\n", | |||
"prompt_number": 6, | |||
"text": [ | |||
MinRK
|
r7739 | "\n", | |
" _ _ _ _ \n", | |||
Fernando Perez
|
r5779 | "\u03b1\u22c5\u03b1\u22c5\u27e8\u03c8\u2758\u03c8\u27e9 + \u03b1\u22c5\u03b2\u22c5\u27e8\u03c6\u2758\u03c8\u27e9 + \u03b2\u22c5\u03b1\u22c5\u27e8\u03c8\u2758\u03c6\u27e9 + \u03b2\u22c5\u03b2\u22c5\u27e8\u03c6\u2758\u03c6\u27e9" | |
] | |||
} | |||
], | |||
"prompt_number": 6 | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "source": [ | |
"<h2>Operators</h2>" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "source": [ | |
"Create symbolic operators" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"collapsed": true, | |||
"input": [ | |||
MinRK
|
r7739 | "A = Operator('A')\n", | |
"B = Operator('B')\n", | |||
Fernando Perez
|
r5779 | "C = Operator('C')" | |
], | |||
"language": "python", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "outputs": [], | |
"prompt_number": 7 | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "source": [ | |
"Test commutativity" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"collapsed": false, | |||
"input": [ | |||
"A*B == B*A" | |||
], | |||
"language": "python", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "outputs": [ | |
{ | |||
"output_type": "pyout", | |||
"prompt_number": 8, | |||
"text": [ | |||
"False" | |||
] | |||
} | |||
], | |||
"prompt_number": 8 | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "source": [ | |
"Distribute A+B squared" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"collapsed": false, | |||
"input": [ | |||
"expand((A+B)**2)" | |||
], | |||
"language": "python", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "outputs": [ | |
{ | |||
"latex": [ | |||
"$$A B + \\left(A\\right)^{2} + B A + \\left(B\\right)^{2}$$" | |||
], | |||
"output_type": "pyout", | |||
"png": "iVBORw0KGgoAAAANSUhEUgAAAMAAAAAZCAYAAABn7SHgAAAABHNCSVQICAgIfAhkiAAABHpJREFU\neJztml2IVVUUx39OTlQ20xiJpZZDE4gUBn0YJE3Q10MZfZEvUS9ST+lDhgWFPRgRFaRGT9mwI8ge\nKoqoCCqikl6ysg/SfOlBjKxetLCymh7Wvnjnsvc5e62zj1dv+wfDPffsfc5e//Wf/XH2uVAo/I+Z\n1e8AjlMuA64HTgSWAhuAr/oaUSFG8SozpwLPdn1fBRwETutPOIUKilctsAz4F5jw30eBaWBl3yIq\nxChetcAsZFrtLB/PR5K6tG8RFWLUeqV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4HLoRcjmwqeecVduDwO2Kti049DOANddNPa7D0dwrsOkze7UA+Ab56eg0\n8C2yB9vNa8gLkmnkoeQjZM91FBlJvvRlh5CdhQ/9307gc2Azsqaz4ND/g9yMmN1E29nIi5W2caTp\na5LrJnnQ4LB71UTf0fKqLziOzX34XDgGR5/jONJifdt3tDlAeCtsUBgkfYOkpVAoFAqFQqFQKAwY\n/wF5Fp03jGX3sQAAAABJRU5ErkJggg==\n", | |||
"prompt_number": 9, | |||
"text": [ | |||
MinRK
|
r7739 | "\n", | |
" 2 2\n", | |||
Fernando Perez
|
r5779 | "A\u22c5B + A + B\u22c5A + B " | |
] | |||
} | |||
], | |||
"prompt_number": 9 | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "source": [ | |
"Create a commutator" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"collapsed": false, | |||
"input": [ | |||
"comm = Commutator(A,B); comm" | |||
], | |||
"language": "python", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "outputs": [ | |
{ | |||
"latex": [ | |||
"$$\\left[A,B\\right]$$" | |||
], | |||
"output_type": "pyout", | |||
"png": "iVBORw0KGgoAAAANSUhEUgAAAC4AAAAWCAYAAAC/kK73AAAABHNCSVQICAgIfAhkiAAAAj5JREFU\nSInt102ITlEYB/CfMUppNFMmDDU0W1EiaZp34SvFQlmKHTtSZKOURjIkSXZjtiwQiykRvTFi4TMk\nHwsLkSmrocEMY3HO5HXn3nHf+84syL/ezrn/55zn+d/7POe59+UvxZTE9RV8wTWczrH/BAZwoEDs\nbizH4hjzDr5F2yw04RwOYRC7sArTsT7prFxF4GX4jp4CokexACM4mmLbEG2XE3wZ6goGrENXHOcU\n9AEdcbyaYuvFa2xEQ5qAItiB8xhSm/CSUB63U2wNmI9+fPqTo3KOYM24Ltz0W7zLqzIFL3Arw7ZP\nKJXtCb6ctjiVTKAH7XF+H8OKZW52FNaZ4Bsj149tWRrrqwzWjql+pfZDvG6O82pQimMbjsR5g1DT\nL2OsV3mdlcex1aMPcyu4HuGpLckboAKn8FVob0kcFtrs2iyN1aR4Jy7hfQU3+pSLHNAS7gk9PIlO\n4YbOZG3OWyot2IvnWFPBt8axWuGNWIRjGfYhIRvzhPIZSC7IK/w4tuJGgt8stMVqhXcI2e7LsK/E\nDKF7jRFNvlJZjY/Giia0Q9KFt4zjsyScjbT+PQ3747w7hz6MPZxLhTpuyljfFgWcTfAr8EP2985D\nPEnhW3EBn7Elp8bfyBY8jcFH8Ezou5W4KLx8RoQDdhProm0h3gh9fhQzhaw9insGhVIpx99jPMBJ\nof6zMK7wicLBCfZHjR9ZeTFp/idT+CbcnSznSeHDwp+J3TX6rRe+13tr9FOJPYK24Qn0+R//Pn4C\niuR3f19QpToAAAAASUVORK5CYII=\n", | |||
"prompt_number": 10, | |||
"text": [ | |||
"[A,B]" | |||
] | |||
} | |||
], | |||
"prompt_number": 10 | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "source": [ | |
"Carry out the commutator" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"collapsed": false, | |||
"input": [ | |||
"comm.doit()" | |||
], | |||
"language": "python", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "outputs": [ | |
{ | |||
"latex": [ | |||
"$$A B - B A$$" | |||
], | |||
"output_type": "pyout", | |||
"png": "iVBORw0KGgoAAAANSUhEUgAAAE4AAAASCAYAAAD15uiRAAAABHNCSVQICAgIfAhkiAAAAi9JREFU\nWIXt1z1oFEEcBfCfMYIWkQQMahQipPUDRKtgCj8LY2Up2im2gmgh2CgqWojYSUgbCxVsrFTED6zU\nBBXRdBIEA1ZRokaNxQwak9272d1LQLgHx87N+8+89252dvZoohQWFay/jAmcrlEzgK3YiK94iu+R\nW4EOXMdZTBbUr4X50E3JWxdb8BODCbXrMI2LGdzeyN2uYmYBdIvkzUUL7kXhOwn1B2Ptzhx+NJpq\nq2JqHnXr5m1JNHQENzCFVQn1fcI2eZLBtWEtxvE5UT8VjdItmjcTncKv34IxfEgY8xaPcrgTwkoe\nLmtonnXL5M3EIHpj+xl+qH2nrowGz8zqb4994zhU1swC6Cblba0zSS8W+3vrf4zfO2M7C33x2oML\nsd2GfryLc47WtV8cjdAtk3cOWvEYq2f0DQqruqnGuKv4hqUZ3DnheN+VaqIAquqWzTsHx3B8Vt/5\nONGeGuNGZD+cYZnwwH1fxEgiquoWypu3VbviJG/8e7R3x2veSdOO9biUw08Jd8UaYRtNYAOuSX8Z\nH8bRBujORNm8czCE7Rn9+4UVOJkzbl/k+3P4bZG/m2okEVV1C+fNOh134BPuZ3Bj8Zq3An1RKGvL\nLMGp2B7IGV8WVXSr5P2DzcLp0ZHD90SDQzn8C7zM6O/GTXzBgXomSqCsbtW8uvAKv2Lha+G9aCZu\nCS+D08Kf6IfYjeXCag1HblI4nR7Ezwie44rwHGoUquhWydtEE038P/gNdbvExvNu4QsAAAAASUVO\nRK5CYII=\n", | |||
"prompt_number": 11, | |||
"text": [ | |||
"A\u22c5B - B\u22c5A" | |||
] | |||
} | |||
], | |||
"prompt_number": 11 | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "source": [ | |
"Create a more fancy commutator" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"collapsed": false, | |||
"input": [ | |||
"comm = Commutator(A*B,B+C); comm" | |||
], | |||
"language": "python", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "outputs": [ | |
{ | |||
"latex": [ | |||
"$$\\left[A B,B + C\\right]$$" | |||
], | |||
"output_type": "pyout", | |||
"png": "iVBORw0KGgoAAAANSUhEUgAAAGAAAAAWCAYAAAA/45nkAAAABHNCSVQICAgIfAhkiAAAA5VJREFU\naIHt2UmIXUUUBuDP2IJZ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2\nr+1ior8s8b9HbKArO/qOmgPeucZWXCjO+NtM3bwn8Jy4IddCMYfBzQU2NOyvpV4GzBRFW6iyBxxK\nNB3fbyKzGkPdm3CTuFKUsyZxZ8P+pr1hk6Ku3dV0IF0YEP83vHGI45hr3CPmd7Kf4QIWsIAFNID/\nASen61ooc9yoAAAAAElFTkSuQmCC\n", | |||
"prompt_number": 12, | |||
"text": [ | |||
"[A\u22c5B,B + C]" | |||
] | |||
} | |||
], | |||
"prompt_number": 12 | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "source": [ | |
"Expand the commutator" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"collapsed": false, | |||
"input": [ | |||
"comm.expand(commutator=True)" | |||
], | |||
"language": "python", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "outputs": [ | |
{ | |||
"latex": [ | |||
"$$\\left[A,B\\right] B + \\left[A,C\\right] B + A \\left[B,C\\right]$$" | |||
], | |||
"output_type": "pyout", | |||
"png": "iVBORw0KGgoAAAANSUhEUgAAAN8AAAAWCAYAAABAHklQAAAABHNCSVQICAgIfAhkiAAABNdJREFU\neJztm0mIHUUYx3+OI+hhZEYc1FEnA8EoIhFjXEJwBBcIMYLiIeAGIioIBtHggiCESBA9RFAPgo7P\nUwwu6EENowmFiWjA5eBuDkYJBoN6MC7RjMvhq8d02l6+6vrqvRfp/+W9qa/631/9XndVdVUPtGrV\nqi86Ivf3FuAA8CbwpOL4jcB+4MEG534aOA9Y7M/5LvCnjx0PjAHPAw8BvwNrgEuAo4EVRp4pFMoQ\n4jh2tQhYBSwDJoBfgR+AB4DdwE/ATl93kPlpVMWrin/K9kXzdwEnWwr8BcwEJpnVFPAP8EhB7Aof\nezVX7hJ4WsoF1o/leCRwH/AdcDtwWiZ2qs/nWeALZX5T9Jdfnep4uZrjp7Btnxn/0kBOQ8BWn+jr\nAYnmdYP3uKwkvg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\n/Cnga0V+g8Yvlldese1Lzf8QudADarTO2A/sc6xThzSb7CGy5OgMvbTqEL/JrpVL4JmEf9N3O7VK\n7d8L/Uzx0nQvdbhzHASGMUrC3+JN8zJdBbyX0L9XWtPn8/8fOPabYYyS8c/f0XPIXPbOSN9h5P+u\nXov0yepuJLe5uop9lhVDsOV4uPCLVcu/VatWrVq1atWqVat5/QsIXxOgwN127AAAAABJRU5ErkJg\ngg==\n", | |||
"prompt_number": 13, | |||
"text": [ | |||
"[A,B]\u22c5B + [A,C]\u22c5B + A\u22c5[B,C]" | |||
] | |||
} | |||
], | |||
"prompt_number": 13 | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "source": [ | |
"Carry out and expand the commutators" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"collapsed": false, | |||
"input": [ | |||
"_.doit().expand()" | |||
], | |||
"language": "python", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "outputs": [ | |
{ | |||
"latex": [ | |||
"$$A B C + A \\left(B\\right)^{2} - B A B - C A B$$" | |||
], | |||
"output_type": "pyout", | |||
"png": "iVBORw0KGgoAAAANSUhEUgAAAO8AAAAZCAYAAADZu3m9AAAABHNCSVQICAgIfAhkiAAABUBJREFU\neJztm1uIVVUYgD9tJrKaaYyGbMzx1JAmXSRNIySD7kxKNyqwC4REFywII43EiMKiAru+VEwnitSH\ngggSpUKyiB4s7YKWD1lIpVQPillZTQ//Osye3Vp7r8u+nIn1weGcvW77/9f+11r/+vc6EIlExiTj\n6hYg4sQ5wCBwODADWAl8XqtEkUgkl6OB5xPX1wH7gWPqEScSidhyJvAPMKCuu4FhYEFtEkUiESvG\nIW5za6tzGjJ4Z9QmUaRWXPe8qxFXbWVGmZeAOchK8TvwMfCnyjsOmAisBR4BDhramIasKOcCfcAB\n4GfgAWAX0ASWAT85yh9Knv6dwGRExjQu/dKN9M2+DFleBfYCS10U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oQdVqqvLvp1IfAL8L4mb7f6Ns0g89VNdMt/J3Ks\nDOQoWIt1yKyyyNAmwG1IqN202S8SH/23AMdi/oePT790Il7D+nyRS8NH7hZV21EooXZYu76zlGAT\nDfkD6iZrDPmfAV9o0qcihxgOADdo8i8DfgPuYvSeYzoSeRvMEjqDJm4rb4j+c5FIpQ6fflkOXJsj\nb9n4Ps+67CgUXzusVd8+4EskRD6MvOtKuwZvIrPOMHJw+gPkPWQ3MttsVXkHkWjbJvXZhpwueRrx\n603MQc7zbgY2IvvYFcBJGXXyaGI3eEP0T3Il8iAhrF+mIAc06iBE7nawo1Bc7PD/oG/b0qT+96SR\nSCnYnCQZy+xDZrtIJBKJRCKRSCQSiUQikcgY4V+hOFAJDK9DFAAAAABJRU5ErkJggg==\n", | |||
"prompt_number": 14, | |||
"text": [ | |||
MinRK
|
r7739 | "\n", | |
" 2 \n", | |||
Fernando Perez
|
r5779 | "A\u22c5B\u22c5C + A\u22c5B - B\u22c5A\u22c5B - C\u22c5A\u22c5B" | |
] | |||
} | |||
], | |||
"prompt_number": 14 | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "source": [ | |
"Take the dagger" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"collapsed": false, | |||
"input": [ | |||
"Dagger(_)" | |||
], | |||
"language": "python", | |||
MinRK
|
r7739 | "metadata": {}, | |
Fernando Perez
|
r5779 | "outputs": [ | |
{ | |||
"latex": [ | |||
"$$- B^{\\dagger} A^{\\dagger} B^{\\dagger} - B^{\\dagger} A^{\\dagger} C^{\\dagger} + \\left(B^{\\dagger}\\right)^{2} A^{\\dagger} + C^{\\dagger} B^{\\dagger} A^{\\dagger}$$" | |||
], | |||
"output_type": "pyout", | |||
"png": "iVBORw0KGgoAAAANSUhEUgAAAWwAAAAaCAYAAACTk2bRAAAABHNCSVQICAgIfAhkiAAABsRJREFU\neJztnXuoFUUYwH9Xr2X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JFWVhJPJK\n2hnJ+Jjur0FPIk/bncjkwRuY/f5DXjq40hvsHOcw4A7gTWQ78GLgWuSHfPKgiv2uwGHIMjPIr83c\njdsW6Dzr1IQqdnbXaCe9zZcCgV5PFfsOO+BOlWD3zDTLf5wJBPLmd/wskQvYEeweCAQCgUAgEAgE\nAoFAIBAIBAKBQCAQCAQCRfEfdUk20oar/w8AAAAASUVORK5CYII=\n", | |||
"prompt_number": 15, | |||
"text": [ | |||
MinRK
|
r7739 | "\n", | |
" 2 \n", | |||
" \u2020 \u2020 \u2020 \u2020 \u2020 \u2020 \u239b \u2020\u239e \u2020 \u2020 \u2020 \u2020\n", | |||
Fernando Perez
|
r5779 | "- B \u22c5A \u22c5B - B \u22c5A \u22c5C + \u239dB \u23a0 \u22c5A + C \u22c5B \u22c5A " | |
] | |||
} | |||
], | |||
"prompt_number": 15 | |||
} | |||
MinRK
|
r7739 | ], | |
"metadata": {} | |||
Fernando Perez
|
r5779 | } | |
] | |||
} |