basic_quantum.ipynb
401 lines
| 34.0 KiB
| text/plain
|
TextLexer
|
r4634 | { | |
|
r5279 | "metadata": { | |
"name": "basic_quantum" | |||
}, | |||
"nbformat": 2, | |||
|
r4634 | "worksheets": [ | |
{ | |||
"cells": [ | |||
{ | |||
|
r5279 | "cell_type": "markdown", | |
"source": [ | |||
"<h1>Basic Symbolic Quantum Mechanics</h1>" | |||
] | |||
|
r4634 | }, | |
{ | |||
"cell_type": "code", | |||
|
r5279 | "collapsed": true, | |
"input": [ | |||
"%load_ext sympyprinting" | |||
], | |||
|
r4634 | "language": "python", | |
"outputs": [], | |||
|
r5279 | "prompt_number": 18 | |
|
r4634 | }, | |
{ | |||
"cell_type": "code", | |||
|
r5279 | "collapsed": true, | |
"input": [ | |||
"from sympy import sqrt, symbols, Rational", | |||
"from sympy import expand, Eq, Symbol, simplify, exp, sin", | |||
"from sympy.physics.quantum import *", | |||
"from sympy.physics.quantum.qubit import *", | |||
"from sympy.physics.quantum.gate import *", | |||
"from sympy.physics.quantum.grover import *", | |||
"from sympy.physics.quantum.qft import QFT, IQFT, Fourier", | |||
"from sympy.physics.quantum.circuitplot import circuit_plot" | |||
], | |||
|
r4634 | "language": "python", | |
"outputs": [], | |||
|
r5279 | "prompt_number": 19 | |
|
r4634 | }, | |
{ | |||
|
r5279 | "cell_type": "markdown", | |
"source": [ | |||
"<h2>Bras and Kets</h2>" | |||
] | |||
|
r4634 | }, | |
{ | |||
|
r5279 | "cell_type": "markdown", | |
"source": [ | |||
"Create symbolic states" | |||
] | |||
|
r4634 | }, | |
{ | |||
"cell_type": "code", | |||
|
r5279 | "collapsed": true, | |
"input": [ | |||
"phi, psi = Ket('phi'), Ket('psi')", | |||
"alpha, beta = symbols('alpha beta', complex=True)" | |||
], | |||
|
r4634 | "language": "python", | |
"outputs": [], | |||
|
r5279 | "prompt_number": 20 | |
|
r4634 | }, | |
{ | |||
|
r5279 | "cell_type": "markdown", | |
"source": [ | |||
"Create a superposition" | |||
] | |||
|
r4634 | }, | |
{ | |||
"cell_type": "code", | |||
|
r5279 | "collapsed": false, | |
"input": [ | |||
"state = alpha*psi + beta*phi; state" | |||
], | |||
|
r4634 | "language": "python", | |
"outputs": [ | |||
{ | |||
|
r5279 | "latex": [ | |
"$$\\alpha {\\left|\\psi\\right\\rangle } + \\beta {\\left|\\phi\\right\\rangle }$$" | |||
], | |||
|
r4634 | "output_type": "pyout", | |
"png": "iVBORw0KGgoAAAANSUhEUgAAAF8AAAAXCAYAAABtR5P0AAAABHNCSVQICAgIfAhkiAAABHBJREFU\naIHt2VmsXWMUB/Dfvb0dqBYtjZCrWvdBOiDVlmpTLTW0UiSGkHjRpoZETSUkTQyJseaIGzFUESXE\nA0rwwJWK4UE0SjwgaFNqnkra4PKw9s7Zd9+99z2nd0By/y/nfGt9a531/771rW/tfRjE/xL3Y8y/\nHUQ/o185NvfCdjSGNTD/JgzNyS7HhF7E0FeYhnYR41pciyaNcbwUB+RklfxaGgyyNxiJP3Kyp7Ac\nVwxgHHksxV+4WMTXjC/wSYN+2vB5TlbJrzeZ3wjG4tsC+SbsgVG99D9tJ+2Ow59Yo5YYnfgNhzXg\np1lsYB6V/AZq8Y9CR4luNZb00v8dO2EzCvPxSE4+XmTx2w34mor3S3Sl/AZq8WcoJ/MWZg5gLCnO\nwmMF8hvxiigZ9WKu8uQq5VdU8ycmgbViHL7Glfgl0Tfh7wK7YTgPR2IDbsnohqod69vFxXRqRr8O\ni/FsCYH+wHjRzYzGQ9guYv8KRyvmmEUrVuB7nISDsAtuwKe5uXXxO1jUqUXJuBn3Jcbpzt2dfD6J\nfTK2l2CS2OXt2C2R76XrhbMav+d+t0VxFtaLjgbnj8rENEpswmqR7Z1YkOjyHFNchJexv1iXexP5\n4diie9fTI782setX5+QniiyYif0y+mxgQ3FX8n0FflDbrNNE2UkxVvfMgKtwSFWAFehocP4iwSeP\n4fhOcKN48c/BR2rJNQ3LMvrn8GCB70p+a8Xij8zJW8XiLxcLv29BYMPFxsBGcVpSXI8hmfEQkWV5\njFHLoEbR0eD8lbmYstiIV5Pv+cWfgB1YmJGtEImb4gHF91s3fmnNb8axeEG0WVlsTj6PEH3slwWO\nd4jjNhlTRM+coknXNmw6Hi7wkc4twwQ8o/hibhP3TB5bxMnNo0Vxa9iCA/FSSQwL8VNO36brM8F0\nvFNi34VfuviTRW3+oMSIaKeWVuhhjiC1PhnvLS7sLCbiiQLbc0XWlOEz5f18B+b1EFuK0UlcRThZ\nXJrrSvST8bHaZdwinhNStInkW1lg241fmkWbEof5hSJqW6fY7e0lQaXoxDa1rJqH1zL6Zblxihax\nue/14L8vMBfH636CWkQJWYPXS2zXq5Vd4kHs3eR7k+ia2vFige9u/NIAfhZH+vic0QLcKo7RuGT+\nKSWBwfOilp6QjCeJ0zQCq8SdsrXA7nQ8XeG3LzED14i2OK37acfyo64lM4914kn9zGQ8XyTTWHGa\nN+CyArtCftk+/2zcJi6ZzUlAb+IC0YLeI148PV4R3FZR867DLNFRrEp07aJ0FGFx8vsDgRGiuViK\nR0Xi7Yk3cL7q/n4bjhFNxGxRZsdgV9ys+N6hH/iV9cAppuLCOvzMUp1t9aCjznm7K67HZajiOESt\nva5CKb/+fKSfr75FWaK49WwE39Q5b644zX2BQ5W/z8milF9vFr9TcbuWYgo+7MFHq6izv/YiDjij\nznmzNfbCrIrjHFGqqtBX/Lqhp9fA7XX4GOg/Uxp9+1nF8c467P8rfxYNYhCDGAT8A+0w3Ws5danI\nAAAAAElFTkSuQmCC\n", | |||
|
r5279 | "prompt_number": 21, | |
"text": [ | |||
"\u03b1\u22c5\u2758\u03c8\u27e9 + \u03b2\u22c5\u2758\u03c6\u27e9" | |||
] | |||
|
r4634 | } | |
], | |||
|
r5279 | "prompt_number": 21 | |
|
r4634 | }, | |
{ | |||
|
r5279 | "cell_type": "markdown", | |
"source": [ | |||
"Dagger the superposition and multiply the original" | |||
] | |||
|
r4634 | }, | |
{ | |||
"cell_type": "code", | |||
|
r5279 | "collapsed": false, | |
"input": [ | |||
"ip = Dagger(state)*state; ip" | |||
], | |||
|
r4634 | "language": "python", | |
"outputs": [ | |||
{ | |||
|
r5279 | "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)$$" | |||
], | |||
|
r4634 | "output_type": "pyout", | |
"png": "iVBORw0KGgoAAAANSUhEUgAAANoAAAAaCAYAAADR9UJvAAAABHNCSVQICAgIfAhkiAAACHpJREFU\neJztnHeMVEUcxz93R0fgwDuaoih4oIJKQMCWnF1AMErU2EATQUQlFjRg7BpDbImCGvVMEKOoIWJs\nJNY1FiygSAmilNiAiFhjQeXOP37zvLezM/Nm3tu7Nbqf5LK7M/Nmfr/9vjflN3NbQZk4hwGzLXnf\nA+e0oi1l/kdMAXqW2oj/KbOBLqU2okxxqHTknQ3sAnzTSraUyecNYDHQvtSGlGk5DgKeBypKbUiM\nW0ttQAtj8u9RYF6Jbfiv8a/y8Tmgvoj1zcD/oZ1hSc8Vx5RU7AbMAuYADcCRhjK+Pl5uSc8Z0voA\n24E9Peo9FOjnUc6FyQYXJq0OAo7OaEdWXHrlAuoxaeXyrxY4ypTRxpB2MDDQYFDaQEE1UAc0WfLj\nVAH9Pcq1JmOAocCTwCbk5l+P3NgfqzIhPg4MaHsLcCdwNXCBo9wIZee1AXVnxabVamA+8Gor2hLH\nRy9fTFq5/NsGnA58C6xMqvw64OZAg1xcCRzoWXYEsjY0kctgQ7eU1x0GXGVI36ql+/pYA9xgyctZ\n0kcBnzvqrAZexNxphmKzwYRLq1lIz5+FNJr56JXzrMullcu/XsAqZFR18iRwkqcxSbQBHgkoPxPo\na8nLpbShO+JTKF2BWwzp/ZGR62T1OcTHUzBPO8Hu366qPVsE8i5VbzGw2WDCpVUP4N4MdqTRzFev\nnGd9Lq2S/Jui55uijkOAZZ7GJDEReDqgfB9gc5HajqhSf6GcBTxmS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M/S6DrTsj/n4atWJ7KOZL1n0Slufy7+OxE7slylTpkyZMmXKlCmTgr8B\n2Kc62Q7y4E4AAAAASUVORK5CYII=\n", | |||
|
r5279 | "prompt_number": 22, | |
"text": [ | |||
"\u239b\u23bd \u23bd \u239e ", | |||
"\u239d\u03b1\u22c5\u27e8\u03c8\u2758 + \u03b2\u22c5\u27e8\u03c6\u2758\u23a0\u22c5(\u03b1\u22c5\u2758\u03c8\u27e9 + \u03b2\u22c5\u2758\u03c6\u27e9)" | |||
] | |||
|
r4634 | } | |
], | |||
|
r5279 | "prompt_number": 22 | |
|
r4634 | }, | |
{ | |||
|
r5279 | "cell_type": "markdown", | |
"source": [ | |||
"Distribute" | |||
] | |||
|
r4634 | }, | |
{ | |||
"cell_type": "code", | |||
|
r5279 | "collapsed": false, | |
"input": [ | |||
"qapply(expand(ip))" | |||
], | |||
|
r4634 | "language": "python", | |
"outputs": [ | |||
{ | |||
|
r5279 | "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 }$$" | |||
], | |||
|
r4634 | "output_type": "pyout", | |
"png": "iVBORw0KGgoAAAANSUhEUgAAAU8AAAAaCAYAAAA3+d4CAAAABHNCSVQICAgIfAhkiAAAB9VJREFU\neJztnHuIFVUcxz+brmBpWq1ampbP3HVVxCil1KsUoehKpRlFUZlZVhQ9oKzIHogZSBm9JDV6UWQU\nPf6oP2x7P6C3UlSQ9tK07KEF+cj++M2ws3NnZs/vnJm5szJfWNg78zu/M/dzvndmzm/OvXWU6gyq\nB55P2H818G1Ox1KqlFalf0uVKlWqVKlSpUqVslaXWh+Aoy4CdgI7an0gB7BKxtmrZJyNMuV6UBZJ\n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Wzje8ynZUmcdwO/x/SvUV6M\nTfi68Cqqj03HKS8Paxi7jEfW3nXmWqsfBlmHfIMjThXs7uRs8nRB6llJS0dMNM+xfZSaga8c2idx\nPg742iG3rwr5MDbh68pLqzx8bDJOeXpYw9hlPLL2rjPXWp089yLF2+aY/f1oWyOWpNXAFwn7TfK0\nILUYV5n+QIRGU4C3HNoncT4JeMcgR1EYm/B15aVVHj42Gac8Paxh7DIeWXs3T66pq5742kfUr23b\nyCRPb+K/0VBr9UshRxznvqRz8SwS4zR4aZW1j03GKU8Paxi7jkeW3i0a11KlSpUqVapUqVKlSpUq\nVapUevofz4SOwufiq5gAAAAASUVORK5CYII=\n", | |||
|
r5279 | "prompt_number": 23, | |
"text": [ | |||
"\u23bd \u23bd \u23bd \u23bd ", | |||
"\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" | |||
] | |||
|
r4634 | } | |
], | |||
|
r5279 | "prompt_number": 23 | |
|
r4634 | }, | |
{ | |||
|
r5279 | "cell_type": "markdown", | |
"source": [ | |||
"<h2>Operators</h2>" | |||
] | |||
|
r4634 | }, | |
{ | |||
|
r5279 | "cell_type": "markdown", | |
"source": [ | |||
"Create symbolic operators" | |||
] | |||
|
r4634 | }, | |
{ | |||
"cell_type": "code", | |||
|
r5279 | "collapsed": true, | |
"input": [ | |||
"A = Operator('A')", | |||
"B = Operator('B')", | |||
"C = Operator('C')" | |||
], | |||
|
r4634 | "language": "python", | |
"outputs": [], | |||
|
r5279 | "prompt_number": 24 | |
|
r4634 | }, | |
{ | |||
|
r5279 | "cell_type": "markdown", | |
"source": [ | |||
"Test commutativity" | |||
] | |||
|
r4634 | }, | |
{ | |||
"cell_type": "code", | |||
|
r5279 | "collapsed": false, | |
"input": [ | |||
"A*B == B*A" | |||
], | |||
|
r4634 | "language": "python", | |
"outputs": [ | |||
{ | |||
"output_type": "pyout", | |||
"prompt_number": 25, | |||
|
r5279 | "text": [ | |
"False" | |||
] | |||
|
r4634 | } | |
], | |||
|
r5279 | "prompt_number": 25 | |
|
r4634 | }, | |
{ | |||
|
r5279 | "cell_type": "markdown", | |
"source": [ | |||
"Distribute A+B squared" | |||
] | |||
|
r4634 | }, | |
{ | |||
"cell_type": "code", | |||
|
r5279 | "collapsed": false, | |
"input": [ | |||
"expand((A+B)**2)" | |||
], | |||
|
r4634 | "language": "python", | |
"outputs": [ | |||
{ | |||
|
r5279 | "latex": [ | |
"$$A B + \\left(A\\right)^{2} + B A + \\left(B\\right)^{2}$$" | |||
], | |||
|
r4634 | "output_type": "pyout", | |
"png": "iVBORw0KGgoAAAANSUhEUgAAAMAAAAAZCAYAAABn7SHgAAAABHNCSVQICAgIfAhkiAAABONJREFU\neJzt2luoFVUcx/FP6jnZsdNNKzVFKLsX1EORpGYIKRkFRgRJD70oFBRFmlQv0ksPQUVYPYXRTcTq\nISqKouhCD0YSdCUKtItd0JJSuunpYe3N2U4ze681M/scOcwXDps9a83M//f/nTXrv9ZsGhoaGhI5\nEmdgyngH0tCTrl5NHttYJgQrsBLHYCOmYtu4RtRQRONVzQzgpdYnnI4RXDhuETUU0XjVB07An1jQ\ncewPrBmfcBq6EOVVag27EoPY3KXPRswraPsHO1vnf5B471QG8XdC/zxt2WvswbH4q/V9Po7Sfy1F\n9CPXMR7XTZFXKfr67tWJrYs+1qPfIM4XppvnMSQMtCmYg4dbbevKBhLBLKxO6F+k7V6jU2geW7E+\nLbRaqTvXsR7XSTevUvT13asnWjd7MaLvilbf63PaBvAz9gkCY0hZrE8SDEw5p0jbmXi84Jy1uCXh\nHt2oshlRZ65TPC6ibq9i9ZXyalJkoJcK08sIZkb0X9z6fDun7UDrOkdE3n8pbovo1+YmvN66Twzd\ntH0pJPi8zPFV+Ey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qh\n1ruqXlXRN1f/vRoXluGu8Q6ij0wkfRNJy2HDNP3fkx5PJpK+iaSloaGhoaGhoWGi8h+sZcLwhv0Q\nuwAAAABJRU5ErkJggg==\n", | |||
|
r5279 | "prompt_number": 26, | |
"text": [ | |||
"2 2", | |||
"A\u22c5B + A + B\u22c5A + B" | |||
] | |||
|
r4634 | } | |
], | |||
|
r5279 | "prompt_number": 26 | |
|
r4634 | }, | |
{ | |||
|
r5279 | "cell_type": "markdown", | |
"source": [ | |||
"Create a commutator" | |||
] | |||
|
r4634 | }, | |
{ | |||
"cell_type": "code", | |||
|
r5279 | "collapsed": false, | |
"input": [ | |||
"comm = Commutator(A,B); comm" | |||
], | |||
|
r4634 | "language": "python", | |
"outputs": [ | |||
{ | |||
|
r5279 | "latex": [ | |
"$$\\left[A,B\\right]$$" | |||
], | |||
|
r4634 | "output_type": "pyout", | |
"png": "iVBORw0KGgoAAAANSUhEUgAAAC4AAAAWCAYAAAC/kK73AAAABHNCSVQICAgIfAhkiAAAAkhJREFU\nSInt182LTWEcB/DPvOWlJpTGYLKwUFMzzYZmMzNJiWl2/gHFQlZm4yUbY4WtQsqUFRYiSoQ4aIpS\n8rKQRORdSZEMM1g8z+XOnXPmnntnZkG+dXvO/X3P7/v73t9znuc8l78UNSXfL+ArLuFAmdw9qMO2\nKuoOYC068QND+BK5RizB2Xjf+xjvx0o0oK9UMMlZuB3fcawK0wU0CGZPpXBtUf8eaku4REowD2qw\nD/VoriK/gOWYhYsp3ANcFhrUlpZcjfH1sdhnkzPeE8erGXwrRvE8j1hShp8XC9XjMT7kEc3AObzK\n4NbhpzCzpUjSElKDRTiEVfF6KIrPKOcwBbX4iOMl8dnYHLntxm8evz3WV1BshdDxK/H72zg241kF\nOtCBOZiLvTE2E6uFXW0NblUimGTEa3FN2KYKOCh0vLOSAhFbYu6yFG4jvmHDRB7zLs5Nwt5evFCK\nO14pevAOj1K4QbwWGtOYJZDnUWnCzlikqyjeEsdqjHfj+gT8J2F2l+JuHsEkJXYUvSnxPmG6d+UR\nLkJrzOvP4BdG/qkJFme5R6VLeIOdT+FexDGt44sm0Czs3zcy+IE4HhF+QC4kRdfteIMFGfcujsKn\nS+IdwvljMCPvpPDyqiuJN2E/RrAjp8cxwfnCGWE0Gnvoz/NcwAm8jPyw0L3CwacFT3Df2Kk+g5sx\nZyReJ/FzW3jNHzZ2HVVkfKqwewq1ipFQ3VklL6ZTe9rEe3FnmrQx3viI8Gcia6vKq9kt/Zw9GWwV\nvA1Pse5//Nv4Bfpvd5tNLRluAAAAAElFTkSuQmCC\n", | |||
|
r5279 | "prompt_number": 27, | |
"text": [ | |||
"[A,B]" | |||
] | |||
|
r4634 | } | |
], | |||
|
r5279 | "prompt_number": 27 | |
|
r4634 | }, | |
{ | |||
|
r5279 | "cell_type": "markdown", | |
"source": [ | |||
"Carry out the commutator" | |||
] | |||
|
r4634 | }, | |
{ | |||
"cell_type": "code", | |||
|
r5279 | "collapsed": false, | |
"input": [ | |||
"comm.doit()" | |||
], | |||
|
r4634 | "language": "python", | |
"outputs": [ | |||
{ | |||
|
r5279 | "latex": [ | |
"$$A B - B A$$" | |||
], | |||
|
r4634 | "output_type": "pyout", | |
"png": "iVBORw0KGgoAAAANSUhEUgAAAE4AAAASCAYAAAD15uiRAAAABHNCSVQICAgIfAhkiAAAAi5JREFU\nWIXt1ztoVEEYBeDPGEGLlQQMahQipBUF0SqYwmdhrCxFO+0F0UKxUVS0ELENaWOhQhorFfGBlY+g\nIppOgmDAKkrUqLGYQddk7u59JAFhDyx3ds4/c87ZuXPnLi2UwpKC9VcwiTMNagaxDZvwFU/wPXKr\n0InrOIepgvqNsBC6efI2xVb8xFCO2g2YwaUEty9yI1XMLIJukbyZaMPdKHw7R/2hWLsrgx+LpmpV\nTC2gbtO8bTkNHcUNTGNNjvp+YZs8TnA1rMcEPufUz4v50i2aN4ku4ddvwzg+5BjzFg8zuBPCSh4p\na2iBdcvkTWIIfbH9FD80vlNXR4NnZ/V3xL4JHC5rZhF0c+VtbzJJH5b6e+t/jN+7YjuF/njtxcXY\nrmEA7+KcY03tF8d86JbJOwfteIS1dX1DwqpubjDuGr5heYI7Lxzvu/OaKICqumXzzsExHJ/VdyFO\ntLfBuFHphzOsEB6474sYyYmquoXyZm3V7jjJG/8e7T3xmnXSdGAjLmfw08JdsU7YRpPCVjqdUZ/C\niBCoqm49yuadg2HsSPQfEFbgZMa4/ZEfyOC3R/5OXiM5UVW3cN7U6bgTn3AvwY3Ha9YK9Eeh1JZZ\nhlOxPZgxviyq6FbJ+wdbhNOjM4PvjQaHM/jneJno78FNfMHBZiZKoKxu1by68Qq/YuFr4b2oHreE\nl8EZ4U/0A+zBSmG1XkRuSjid7sfPKJ7hqvAcmi9U0a2St4UWWvh/8Bt1v8TG07AChQAAAABJRU5E\nrkJggg==\n", | |||
|
r5279 | "prompt_number": 28, | |
"text": [ | |||
"A\u22c5B - B\u22c5A" | |||
] | |||
|
r4634 | } | |
], | |||
|
r5279 | "prompt_number": 28 | |
|
r4634 | }, | |
{ | |||
|
r5279 | "cell_type": "markdown", | |
"source": [ | |||
"Create a more fancy commutator" | |||
] | |||
|
r4634 | }, | |
{ | |||
"cell_type": "code", | |||
|
r5279 | "collapsed": false, | |
"input": [ | |||
"comm = Commutator(A*B,B+C); comm" | |||
], | |||
|
r4634 | "language": "python", | |
"outputs": [ | |||
{ | |||
|
r5279 | "latex": [ | |
"$$\\left[A B,B + C\\right]$$" | |||
], | |||
|
r4634 | "output_type": "pyout", | |
"png": "iVBORw0KGgoAAAANSUhEUgAAAGAAAAAWCAYAAAA/45nkAAAABHNCSVQICAgIfAhkiAAAA3tJREFU\naIHt2E2sXVMUB/DfexqvUvr0QxXFQI2k8dn4at+A1wglkfiImRIhEhEDDBrVCNLGM2qjHRA6EMSE\ngfhIkSt9jU7E90cISaWEpBJaDarFYO3b3l7n3LPP6733Te5/ss/Za+3/XufstdZeezPAtGKo7f1N\n/ImteKpi7Docgwc76GzCpTgPf+H91MJcnISX8Sh+r2F3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|||
"[A\u22c5B,B + C]" | |||
] | |||
|
r4634 | } | |
], | |||
|
r5279 | "prompt_number": 29 | |
|
r4634 | }, | |
{ | |||
|
r5279 | "cell_type": "markdown", | |
"source": [ | |||
"Expand the commutator" | |||
] | |||
|
r4634 | }, | |
{ | |||
"cell_type": "code", | |||
|
r5279 | "collapsed": false, | |
"input": [ | |||
"comm.expand(commutator=True)" | |||
], | |||
|
r4634 | "language": "python", | |
"outputs": [ | |||
{ | |||
|
r5279 | "latex": [ | |
"$$\\left[A,B\\right] B + \\left[A,C\\right] B + A \\left[B,C\\right]$$" | |||
], | |||
|
r4634 | "output_type": "pyout", | |
"png": "iVBORw0KGgoAAAANSUhEUgAAAN8AAAAWCAYAAABAHklQAAAABHNCSVQICAgIfAhkiAAABOVJREFU\neJztm0toXUUYx3+JCWnF+KrU+kYLYtHahY+gJKWIr9q6EVypFHRRxYAFn3RjXFnBjYKK1EgEURc+\nUNCIQh0fQVxpiwuRgO83ilItautj8c3h3hxnzpk58829t3J+EE4y38x3vu9/58ycOzOBlpaWvjBU\n+vtV4HfgdeChmrb3AocAdzS47wxwOTAB/A0sAPusbRw4GXjJ1vvBlm8DNgCjwCYlnzmI0RDSdCwY\nAq4EJoFzkfzHgOeAB4HVwAc2pkHXr446vXz6z5AvPw39MYE3WwvsB56KDLKbUST55x22s6z/PcBw\nyWYy+NTERNTV0PFUe895pAOM2/Jh4HrgSeBTYDogvkHQr4oQvUyFLUd+avp7DV0MAa8A/wC7IoIs\nc4H1caPHPm/tZ5fKTQafPo4GTgmsW2AC62nouAXYCzyKzAYuHrf3OCMgPm39oJmGLkL1MhU27fyS\n9G8ygm0BXgN+BVY1aF+w3l7f8NjXAH8Bn/fR54XA1RH3jyFVxylgFvngtyJ5uZgHvgI+CvCZ4zPR\n0lCj32nmp66/qbEfhQQ+AiwCPwUE6eNl4GuP7SpktLjPYTMZfPrYDNwWUR/CZr5UHY8EPkNyXV5T\n9xzgicD4tPWDZhqWidHLVNi08suiv9dgeQ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||
|
r5279 | "prompt_number": 30, | |
"text": [ | |||
"[A,B]\u22c5B + [A,C]\u22c5B + A\u22c5[B,C]" | |||
] | |||
|
r4634 | } | |
], | |||
|
r5279 | "prompt_number": 30 | |
|
r4634 | }, | |
{ | |||
|
r5279 | "cell_type": "markdown", | |
"source": [ | |||
"Carry out and expand the commutators" | |||
] | |||
|
r4634 | }, | |
{ | |||
"cell_type": "code", | |||
|
r5279 | "collapsed": false, | |
"input": [ | |||
"_.doit().expand()" | |||
], | |||
|
r4634 | "language": "python", | |
"outputs": [ | |||
{ | |||
|
r5279 | "latex": [ | |
"$$A B C + A \\left(B\\right)^{2} - B A B - C A B$$" | |||
], | |||
|
r4634 | "output_type": "pyout", | |
"png": "iVBORw0KGgoAAAANSUhEUgAAAO8AAAAZCAYAAADZu3m9AAAABHNCSVQICAgIfAhkiAAABbRJREFU\neJztm3loHUUcxz82hzHyvGvaRBsx0VoPPGtbPGOwihVFBSseUBQMFGy1Fq0XKv5TFdOoqMW7FQ8C\nVgQVEVOLokXURMFqKGo1aqgVRI0talvjH79ZstnsvJ3Z2bf7rPOB5e0xM/v7zvx2d+Y388Dj8Xg8\nudAENBdthKd4divaAI8xNcDtwDAwFbgAuAz4qkijPB5PMlcDV4aOHwTeL8gWTxUwqWgDPMYcCFwf\nOh4ATsK34f8W227zxUA98FKZNI8ArZpr24EhlX99mTJqgKOBOcAs4E/gVeBNdX0x8uXJmyT99cDf\nmms29aIrZ3fgL7XfAxwLdCRa7UYW7RklLz9yJSs/LFzvZOAX4LGEdPXAMcAo8DLQCNSq7SBE7Chw\nkyb/ucA3QC/QBbQBhwF3IAKXAO+lEeBIkv6zgNPL5Lepl+OQBtfRBnwNtJubnxrX9oySlx+5kpUf\nVoXep1XmVwzSzlNp58dcqwO2AFuVwQEl4HHgN6BTU+5yVe5dBjbUGKSxoZz+NuBWgzJs6mU58raP\nsg/SuG0G98uKNO2po9J+5ErWfli43lOAlcA/mH2271VGNMVcmwT8BGwDGkLn+oDNyF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BDZcpNUy9LMJtvrCRp7IZi/MgVFz8sRG/w5S0hb50LkUUBXUifPhzW7gLO\nVPsdyJjhdWSN7UKk6zoXCYsvQ7omAAcA5yHd2EXAwxHjtiMLDx5QIr4FPkG6MA1KcJ9GWFa46N8A\nfIhEhmcCH6k0DaSvl4ORKYPubORZ4WJ3kX7kSho/LFRvsLSuxPhI2CjwNmP/YAHpDkRXlPQjEbq5\n6Jfp7QQ+QwbdJrQib74B9P/QMaEHqXCTbrOL/rCuFuBHtV9H+nppUedHDWzPGhe7q8mPXDHxw11J\nb1WxAvnLnMfj+Y8xDbM10B6Px+PxeDwej8fj2TX5F7SSWLkkWnK7AAAAAElFTkSuQmCC\n", | |||
|
r5279 | "prompt_number": 31, | |
"text": [ | |||
"2 ", | |||
"A\u22c5B\u22c5C + A\u22c5B - B\u22c5A\u22c5B - C\u22c5A\u22c5B" | |||
] | |||
|
r4634 | } | |
], | |||
|
r5279 | "prompt_number": 31 | |
|
r4634 | }, | |
{ | |||
|
r5279 | "cell_type": "markdown", | |
"source": [ | |||
"Take the dagger" | |||
] | |||
|
r4634 | }, | |
{ | |||
"cell_type": "code", | |||
|
r5279 | "collapsed": false, | |
"input": [ | |||
"Dagger(_)" | |||
], | |||
|
r4634 | "language": "python", | |
"outputs": [ | |||
{ | |||
|
r5279 | "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}$$" | |||
], | |||
|
r4634 | "output_type": "pyout", | |
"png": "iVBORw0KGgoAAAANSUhEUgAAAWwAAAAaCAYAAACTk2bRAAAABHNCSVQICAgIfAhkiAAABwZJREFU\neJztnXmIVVUYwH8z4zKmJYWaW2XmUpJmWYqhElGRLWpkCy06xRj1RwWalQSlLZqpbf+0CbaIBdkC\ntkiLmUUFZSlaFlmURYYlWEG7Tn989zHXO/e+d9Z7507n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yD/LJWC7I/8bJY/DDgcWSeqQH4A/l5wulRedqD\nDrZ0BDtX6Aqch2ynGo0sqG1DHDSv/26iOoedRRnaDORXp6ro2N1XO+lIvhQI/C+4AznEEMiXYPdA\nIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAoiv8ALJD8MaP0SzQAAAAASUVORK5CYII=\n", | |||
|
r5279 | "prompt_number": 32, | |
"text": [ | |||
"2 ", | |||
" \u2020 \u2020 \u2020 \u2020 \u2020 \u2020 \u239b \u2020\u239e \u2020 \u2020 \u2020 \u2020", | |||
"- B \u22c5A \u22c5B - B \u22c5A \u22c5C + \u239dB \u23a0 \u22c5A + C \u22c5B \u22c5A" | |||
] | |||
|
r4634 | } | |
], | |||
|
r5279 | "prompt_number": 32 | |
|
r4634 | } | |
] | |||
} | |||
|
r5279 | ] | |
|
r4634 | } |