{ "metadata": { "name": "", "signature": "sha256:6dc313d27eabce6868814ce31b9d5f694fa6310380af4595343c75198d6a6529" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Examples of using BosonOperator and FermionOperator" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "J. R. Johansson, http://jrjohansson.github.com, " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Note: This notebook requires and experimental branch of sympy available at: https://github.com/jrjohansson/sympy" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from sympy import *\n", "init_printing()" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 1 }, { "cell_type": "code", "collapsed": false, "input": [ "from sympy.physics.quantum import *\n", "from sympy.physics.quantum.boson import *\n", "from sympy.physics.quantum.fermion import *\n", "from sympy.physics.quantum.operatorordering import *" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Docstrings" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#help(BosonOp)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 3 }, { "cell_type": "code", "collapsed": false, "input": [ "#help(FermionOp)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 4 }, { "cell_type": "code", "collapsed": false, "input": [ "help(normal_order)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Help on function normal_order in module sympy.physics.quantum.operatorordering:\n", "\n", "normal_order(expr, recursive_limit=10, _recursive_depth=0)\n", " Normal order an expression with bosonic or fermionic operators. Note\n", " that this normal order is not equivalent to the original expression, but\n", " the creation and annihilation operators in each term in expr is reordered\n", " so that the expression becomes normal ordered.\n", " \n", " Parameters\n", " ==========\n", " \n", " expr : expression\n", " The expression to normal order.\n", " \n", " recursive_limit : int (default 10)\n", " The number of allowed recursive applications of the function.\n", " \n", " Examples\n", " ========\n", " \n", " >>> from sympy.physics.quantum import Dagger\n", " >>> from sympy.physics.quantum.boson import BosonOp\n", " >>> from sympy.physics.quantum.operatorordering import normal_order\n", " >>> a = BosonOp(\"a\")\n", " >>> normal_order(a * Dagger(a))\n", " Dagger(a)*a\n", "\n" ] } ], "prompt_number": 5 }, { "cell_type": "code", "collapsed": false, "input": [ "help(normal_ordered_form)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Help on function normal_ordered_form in module sympy.physics.quantum.operatorordering:\n", "\n", "normal_ordered_form(expr, independent=False, recursive_limit=10, _recursive_depth=0)\n", " Write an expression with bosonic or fermionic operators on normal\n", " ordered form, where each term is normally ordered. Note that this\n", " normal ordered form is equivalent to the original expression.\n", " \n", " Parameters\n", " ==========\n", " \n", " expr : expression\n", " The expression write on normal ordered form.\n", " \n", " recursive_limit : int (default 10)\n", " The number of allowed recursive applications of the function.\n", " \n", " Examples\n", " ========\n", " \n", " >>> from sympy.physics.quantum import Dagger\n", " >>> from sympy.physics.quantum.boson import BosonOp\n", " >>> from sympy.physics.quantum.operatorordering import normal_ordered_form\n", " >>> a = BosonOp(\"a\")\n", " >>> normal_ordered_form(a * Dagger(a))\n", " 1 + Dagger(a)*a\n", "\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Test Boson operators" ] }, { "cell_type": "code", "collapsed": false, "input": [ "a = BosonOp('a')\n", "b = BosonOp('b')" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 7 }, { "cell_type": "code", "collapsed": false, "input": [ "a.is_annihilation, Dagger(a).is_annihilation" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 8, "text": [ "(True, False)" ] } ], "prompt_number": 8 }, { "cell_type": "code", "collapsed": false, "input": [ "Commutator(a, Dagger(a)).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$1$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAPBAMAAAArJJMAAAAAJFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAADHJj5lAAAAC3RSTlMAzRAiu5mrdu/dZmiL4QAAAAAJcEhZcwAA\nDsQAAA7EAZUrDhsAAAAjSURBVAgdY2BgEGJgYDDZxMCgEgYkGNhJJVgzdmYB9TEwAACPpQrvlUCH\ncAAAAABJRU5ErkJggg==\n", "prompt_number": 9, "text": [ "1" ] } ], "prompt_number": 9 }, { "cell_type": "code", "collapsed": false, "input": [ "Commutator(Dagger(a), a).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$-1$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAABgAAAAPBAMAAAAMihLoAAAAJ1BMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAilU6eAAAADHRSTlMAEM3dMiK7mat272a9noTYAAAACXBI\nWXMAAA7EAAAOxAGVKw4bAAAALklEQVQIHWNggANFOIuBIewggiNWgcRh4CSTI2QMAioMZBsAcxB7\n1+FuGBtMAwDSnw2AS5zPhQAAAABJRU5ErkJggg==\n", "prompt_number": 10, "text": [ "-1" ] } ], "prompt_number": 10 }, { "cell_type": "code", "collapsed": false, "input": [ "Commutator(a, a).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$0$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAOBAMAAADkjZCYAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEJmJdjLNVN0iZu+7\nq0QgoRR7AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAVklEQVQIHWNgEDJRZWBgSGeQmMDAtYGBOYGB\n5wID+0cG/gsMfN8Z5BUY+L4wzDdgYP0MJeUNQCL8Cgzs3xk4DjBwfWRg2cDAlMDA0M4gHcDAIOxy\nlQEA9FISlFfRJtkAAAAASUVORK5CYII=\n", "prompt_number": 11, "text": [ "0" ] } ], "prompt_number": 11 }, { "cell_type": "code", "collapsed": false, "input": [ "Commutator(Dagger(a), Dagger(a)).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$0$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAOBAMAAADkjZCYAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEJmJdjLNVN0iZu+7\nq0QgoRR7AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAVklEQVQIHWNgEDJRZWBgSGeQmMDAtYGBOYGB\n5wID+0cG/gsMfN8Z5BUY+L4wzDdgYP0MJeUNQCL8Cgzs3xk4DjBwfWRg2cDAlMDA0M4gHcDAIOxy\nlQEA9FISlFfRJtkAAAAASUVORK5CYII=\n", "prompt_number": 12, "text": [ "0" ] } ], "prompt_number": 12 }, { "cell_type": "code", "collapsed": false, "input": [ "Dagger(Dagger(Dagger(a)))" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{a}^\\dagger}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAABIAAAATBAMAAABvvEDBAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAIquJdjLdEETvu2aZ\nVM0GsGrEAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAdklEQVQIHWNggAANKM3AgGCZw8TWrZkLZRaY\nF8AEVWEMhrVYWLpwMZB5jMqu6QwMR4GsTgGuDwwMhgwM7LMZeBYwMLgzMPB8Z2BzYGAAGsy5gKE+\nAKiIgaHegOE+SATIusCwjlcAxOJz4E5iBjEY2FVMhTxADACdGxMZ3sSvXwAAAABJRU5ErkJggg==\n", "prompt_number": 13, "text": [ " \u2020\n", "a " ] } ], "prompt_number": 13 }, { "cell_type": "code", "collapsed": false, "input": [ "Commutator(a, Dagger(Dagger(a))) #.doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$0$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAOBAMAAADkjZCYAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEJmJdjLNVN0iZu+7\nq0QgoRR7AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAVklEQVQIHWNgEDJRZWBgSGeQmMDAtYGBOYGB\n5wID+0cG/gsMfN8Z5BUY+L4wzDdgYP0MJeUNQCL8Cgzs3xk4DjBwfWRg2cDAlMDA0M4gHcDAIOxy\nlQEA9FISlFfRJtkAAAAASUVORK5CYII=\n", "prompt_number": 14, "text": [ "0" ] } ], "prompt_number": 14 }, { "cell_type": "code", "collapsed": false, "input": [ "Commutator(a, b).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${a} {b} - {b} {a}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAEEAAAAOBAMAAACC12zPAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAIquJdjLdEETvu2aZ\nVM0GsGrEAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAxUlEQVQYGWNgAIOqaRAaTmIIMDyCy0EZGAJ/\n0VWgC3B8R1OBIcCcgKYCWYBR2TWdgU/F5wKKGrAAWIqBoVOA6wND/XOGjygqwAJgKQb22Qw8Cxju\nFzB8RlEBEoBIMfB8Z2BzYDjHwA5SUZcGAk+BLJAARIqBcwFDfQDDGwYOVO+BBCBSDPUGDPcZCn6D\nzEIGIAGIFEP9BYZ1vAI/GCo3ICtgAAlApBj4HLiTmBm0GdagKAALQKQY2FVMhTwYapxQjQALQKQA\nvhFEEKnjnJwAAAAASUVORK5CYII=\n", "prompt_number": 15, "text": [ "a\u22c5b - b\u22c5a" ] } ], "prompt_number": 15 }, { "cell_type": "code", "collapsed": false, "input": [ "Commutator(a, b).doit(independent=True)" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$0$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAOBAMAAADkjZCYAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEJmJdjLNVN0iZu+7\nq0QgoRR7AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAVklEQVQIHWNgEDJRZWBgSGeQmMDAtYGBOYGB\n5wID+0cG/gsMfN8Z5BUY+L4wzDdgYP0MJeUNQCL8Cgzs3xk4DjBwfWRg2cDAlMDA0M4gHcDAIOxy\nlQEA9FISlFfRJtkAAAAASUVORK5CYII=\n", "prompt_number": 16, "text": [ "0" ] } ], "prompt_number": 16 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Test Fermion operators" ] }, { "cell_type": "code", "collapsed": false, "input": [ "c = FermionOp('c')\n", "d = FermionOp('d')" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 17 }, { "cell_type": "code", "collapsed": false, "input": [ "Commutator(c,Dagger(c))" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$- \\left[{{c}^\\dagger},{c}\\right]$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAEQAAAAaBAMAAAD8uecGAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEM3dMrsiiXZU76uZ\nZkSnMwLyAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAA5UlEQVQoFWNgwAL2YRGDCLEam0EYSEr4jM2R\n1TPDOIUwBojORubAlATFrEQSxqpEoFCAkBKGLUgqsFvEEEkVJTsJm4IULtg8Xd7hwHAEZgqIg+Hp\n5AlMCgxlUCVgDoaS5QzcExgaoUrAnGwGIWMQUAEJAkOX5yOIAQ05CAfdFK4AkBIogHDQlcgXwOSB\nNISDroT/AgPDBJgqCAddCc8GBhkHkBJ5BaDDwBx0JQzldxtAKhiYQe4GczCUgOVBxDMYC7cSoKMg\nAKcSRsJKeGGGYMYRXAbOwGkRXAWaKbB8hJBn4DO2BgBSmizYW7uajQAAAABJRU5ErkJggg==\n", "prompt_number": 18, "text": [ " \u23a1 \u2020 \u23a4\n", "-\u23a3c ,c\u23a6" ] } ], "prompt_number": 18 }, { "cell_type": "code", "collapsed": false, "input": [ "AntiCommutator(c,Dagger(c))" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$\\left\\{{{c}^\\dagger},{c}\\right\\}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAADgAAAAbBAMAAADbkFG1AAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAMolUmc0idhCru+9m\n3URozekSAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABK0lEQVQoFWNgQIB5CCacxagMZaJIPhEAi7om\nQCU1oDSYYosCUew/oGJLl2yGssAUtwKQ4gyACjVoNEBZYIoLJA6XZJiILAcRR0guJltyMj6dKP6E\n2Mm1AKRBqVyAwRGmk0m9EOrQ7gKgWK4BawCDGlSS7TJDKAMDD9D/bCEgoU0MnAYMFVBJoPdB1usK\nMJxNANIs4FBqALJAwL8BTHGEMzDHAFncC8BcKLELQpseYGDIN2Bg6FeAioMojk9gDt9HIAVyLf8B\nBgagGij4w8DADHUtKPhYJjC0CICk+oEcBk8GDqCvwMEKJpTOFIC18YJcxqRzHEgiJMEyIOIZnIVF\n8gAeSQ58kjxwjQzglMC0ASGAzOJ1APEiG0AkBpjbABJiRk0eUFWvDkAZuCgAZBQ3Pr2Io6QAAAAA\nSUVORK5CYII=\n", "prompt_number": 19, "text": [ "\u23a7 \u2020 \u23ab\n", "\u23a8c ,c\u23ac\n", "\u23a9 \u23ad" ] } ], "prompt_number": 19 }, { "cell_type": "code", "collapsed": false, "input": [ "AntiCommutator(c, Dagger(c)).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$1$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAPBAMAAAArJJMAAAAAJFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAADHJj5lAAAAC3RSTlMAzRAiu5mrdu/dZmiL4QAAAAAJcEhZcwAA\nDsQAAA7EAZUrDhsAAAAjSURBVAgdY2BgEGJgYDDZxMCgEgYkGNhJJVgzdmYB9TEwAACPpQrvlUCH\ncAAAAABJRU5ErkJggg==\n", "prompt_number": 20, "text": [ "1" ] } ], "prompt_number": 20 }, { "cell_type": "code", "collapsed": false, "input": [ "AntiCommutator(Dagger(c), c).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$1$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAPBAMAAAArJJMAAAAAJFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAADHJj5lAAAAC3RSTlMAzRAiu5mrdu/dZmiL4QAAAAAJcEhZcwAA\nDsQAAA7EAZUrDhsAAAAjSURBVAgdY2BgEGJgYDDZxMCgEgYkGNhJJVgzdmYB9TEwAACPpQrvlUCH\ncAAAAABJRU5ErkJggg==\n", "prompt_number": 21, "text": [ "1" ] } ], "prompt_number": 21 }, { "cell_type": "code", "collapsed": false, "input": [ "AntiCommutator(c,d).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${c} {d} + {d} {c}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAEEAAAAQBAMAAAC7Cw8kAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAiXYyIt1Uze+rmRC7\nZkTTotXTAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAA5UlEQVQoFWWQPw/BQBiHfxZFpf4sVnyCDnaT\nwcZmbMRmaSyX2CQmMTQ+gc2ogwEL30AXo8QHIGHpIhF97/pW2t5y1+d5cr07IByPBa94ThGfTTQn\niPFRZhcFTBhkemo1ZAAmDLR1smACVJomutW2FS8UIYeOpdnGHBc3VihCDpghb+09bFSA8ByKkEOB\n7rB10Y8XkkiH3DlQS+hfKmpCDISYMpEOpzKgv5F96ZQg/Isi5ICSB4x9FO0RfUWFJOSCczg4mhNc\nHdlzAUmkC57jVseh0Vrd5RZ8F0XIpcb/1VMqBM+k+AHB0ESrsAQx6QAAAABJRU5ErkJggg==\n", "prompt_number": 22, "text": [ "c\u22c5d + d\u22c5c" ] } ], "prompt_number": 22 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Commutators between fermions and bosons" ] }, { "cell_type": "code", "collapsed": false, "input": [ "Commutator(a, c).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$0$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAOBAMAAADkjZCYAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEJmJdjLNVN0iZu+7\nq0QgoRR7AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAVklEQVQIHWNgEDJRZWBgSGeQmMDAtYGBOYGB\n5wID+0cG/gsMfN8Z5BUY+L4wzDdgYP0MJeUNQCL8Cgzs3xk4DjBwfWRg2cDAlMDA0M4gHcDAIOxy\nlQEA9FISlFfRJtkAAAAASUVORK5CYII=\n", "prompt_number": 23, "text": [ "0" ] } ], "prompt_number": 23 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Simplifying operator expressions" ] }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Test operator ordering of bosons" ] }, { "cell_type": "code", "collapsed": false, "input": [ "normal_ordered_form(Dagger(a) * a)" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{a}^\\dagger} {a}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAB8AAAATBAMAAACaQstxAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAIquJdjLdEETvu2aZ\nVM0GsGrEAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAjElEQVQYGWNggAANKA2nMATM4VIQxro1c1FF\nCswLUAUYVNH4DGsJCuiiq0ByB6OyazoDw1GgCgiLoVOA6wMDgyFQAMJin83As4CBwZ2BAcri+c7A\n5sDAAHQXlMW5gKE+AKiegQHKqjdguA+SZ2CAsuovMKzjFQALQFh8DtxJzCA+A5TFrmIq5AEWgLAA\nNNUfGy2S/ZoAAAAASUVORK5CYII=\n", "prompt_number": 24, "text": [ " \u2020 \n", "a \u22c5a" ] } ], "prompt_number": 24 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_ordered_form(a * Dagger(a))" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$1 + {{a}^\\dagger} {a}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAEEAAAAVBAMAAADrxp6XAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAzRAiu5mrdu/dZlSJ\nRDLkM64aAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAA3UlEQVQoFWNgwAFycYgjhAmrOIRQjJ3l6NqN\nXQIuqnBIAc5mEEIwkVh5CLbJJwQbieUNZ6uEwVQwGcAFgQyECgZ2mAruAmQV2QgODhVI4YGhgjmn\nbhIDQxzQDAgL05YbBiwfGBgOA1VAWBgqmLoYWB0YGIoYGKAsDBWsnxg4gW5WYGCAsqAqeAQFJRsF\nBQMYGDgcGPQfAK1AsNBdqn+AYT/IBAYGGAtDxQYGR24DsAooC10FYwHXNB6QAgYoizXjZxaYzwAN\nU6b0c2a1YBEEC6IApgLKw0bxLsAmygAAFlQ3VdFpO00AAAAASUVORK5CYII=\n", "prompt_number": 25, "text": [ " \u2020 \n", "1 + a \u22c5a" ] } ], "prompt_number": 25 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_ordered_form(a * Dagger(a) * a)" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{a}^\\dagger} \\left({a}\\right)^{2} + {a}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAGAAAAAbBAMAAABxU5cJAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAIquJdjLdEETvu2aZ\nVM0GsGrEAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABv0lEQVQ4EXWTP0gCURzHv3bp6Z3K4doiZNAS\nGBQuDYJEjba0NPSHoFXaWlKIgjZdi8KmFjOnpgiXlgiypS1yiGjxMCJsCXvv3vudp3f3Bn/f7/fz\nfu/P3Qn4joVawZd5AcUYa3vlvlnICH75QmDaxSKlwK8rHATuBiDWG3CXyrgSIJT1CGVUr5254YI7\nspNCRjzCNZHoeVb1po09xJSVBaoScXuAQ+m8ypUVxulVxYFg5/XSa6bMREOOZoynEen3u8KqBsWO\nOmPpCiVqmRSrsazDkLTeQ3iDLDq2cjUEJhd3gHs+QWmyn8TcKruJ85HaOwh0bGjsrLO8QWsA4Qqu\nmbzjXg5qEEg9RbQKLHEYagF7DTww+cK9HNQgULRnfQLsFECkBDwVsM3kOvdyUINAkSqKeUl4wwnU\nH2btBsU0P85Ns8kygYppvMFa3zqS+o1YVwWO2AQacgeJii3UY4Zg7NLqH7T2s+elJYpn9S1FrqUk\ngXfcJNPAIy3PKt1BIDU1n1iWlL+43dxKqgR8yogXapDIQbBJJlAm5WhwRCRvSShZUqyGGw4zLDVD\n+v3h3NfZf6AL3ykjYEJ4nXYawcz+AxjGXnyLG4MSAAAAAElFTkSuQmCC\n", "prompt_number": 26, "text": [ " \u2020 2 \n", "a \u22c5a + a" ] } ], "prompt_number": 26 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_ordered_form(a * a * Dagger(a))" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{a}^\\dagger} \\left({a}\\right)^{2} + 2 {a}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAGkAAAAbBAMAAACNRrzDAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAIquJdjLdEETvu2aZ\nVM0GsGrEAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACAUlEQVQ4EXWTP2gTYRjGn8vZfLmkd1yz6hBo\nBBchotIl4GkRO9alSwvGPyA4HW4uJiAKTrarYolD6VJrJicph+BSBNulW2mGUlx6RETiIuf35/0u\nd727b8j7Pr/nee87vi8HFK72ll/oFRqmWxoWmoVG2Z36VWiScSkTsHrG3ww8A7JTgD0+E8rIuQwB\nyl4OTKLtrfdJqfp2FqWJP6dOeVnh2iKvtSCdyVEXJTP6ZAn5Ai9JUbmwu5EG+Ci1o+/VAaZODzdT\nIdbAjV6K0NS8hudasKJopCRzZS35sFZ1QNXLsqxpyJK27UlsdVD6owOqyvuqdGJ4Gnf83jwpnHFi\nypi9/Rj4Jgwz4D/1a0s+kDx1muJeeQwVx2u3OgKucIbqAKis4RNvd4SmNZl606I4e4fpPnBHJMp7\nwLMBdnl7IDStydQTUHx6LP85/KUAqwf88PGIt/eEphVP8cdT3Oqju0i2mHoLJg4qnjLD8GQ9DAMR\nucUfrOLdFo4gd5JvyH7DHjHglUjR0nvZAWYo3t3Dtu0qn58G+4fqcD//NFaAmxR3vNoDkx5qNoBj\nfG60gO+ERKG9jIdXv3YozprX6wsUEbf8dP5uswf8JCQKTTlRFHWScR25rxtjVXeTqQRJt1+0ND3d\n8VoZJEROW3UJPs8xC1H8VX4ojOQZ5xWs6T3zMpz9B2V2azi9jModAAAAAElFTkSuQmCC\n", "prompt_number": 27, "text": [ " \u2020 2 \n", "a \u22c5a + 2\u22c5a" ] } ], "prompt_number": 27 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_ordered_form(a * a * a * Dagger(a))" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{a}^\\dagger} \\left({a}\\right)^{3} + 3 \\left({a}\\right)^{2}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAIYAAAAbBAMAAABLr+o/AAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAIquJdjLdEETvu2aZ\nVM0GsGrEAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACVUlEQVQ4EY2UP2gTURzHv/FMXpK7C2dXHQpW\ncBFijRRKh0AR3YwILg7+QXARPMSliwmIQrd2EGlFiZNLbW5yUSSLSykYFzcxQxGXhoh/KkiNv3fv\n/e7O3rvoG+73/f2+n/e73929BMhctWk/04uNubUxlBM47RjNUpa3r5/lAU7VHma77BS8/BfWR1kk\notNPJBmy1Mr9ZMvUY6HB7rjo7rA7wyKOt7diPUYV6tpcX3ucxv7nnQJzvNGfUV/ooirY4VPkd9ne\nE5OU3Y3MI6HKtXWB0oVG7ldkK/fEbE+KJIW7uMfU81BU1DRABSh49kN2VTwEN+yapPLbH54xpXrM\nc7q/inxt2lOp0PFsDz9kJUmVRqMhbzoWimVOxRIrim5dJYst8VsqMwWE56N4WcF03Y5U3IOUfBYD\nlTt86jrwRu6xunSZqF3wE1+MKjwHvSYJGKhFr0xPdJxMlAO6yzI6JF/LXK+ox/kbspKmxCPIs3Ra\nuoUefdIAGyTfy1yvqAesB1RKU84O5Gml8YFSC3jr4xrJSzLXK+6BFeLSVKmNZkPD0l2F+E5p1MMa\nDD49GQy6VDsAdGjSNNWs4qOaIpxSfIU7FMB92sOL5xj56AQmqtnDuuspnN6W2EW5/878TleBm0Sm\nqUrdvmrpO1qTwBZeTFaBTR6CIs/xEu43StOUmDo5cUZvkKfn1vy5qRbwWZdk4B7FzQ1ywjNmoCQp\n1xUV6Ke5xIoi9+CSmWL3FQurzopiMUgkJM0UM2VPqztcMcXxVPTv8tS0l2v/oA4qzuZ5eNvfcQ/1\nBxDVkbPIPgSCAAAAAElFTkSuQmCC\n", "prompt_number": 28, "text": [ " \u2020 3 2\n", "a \u22c5a + 3\u22c5a " ] } ], "prompt_number": 28 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_ordered_form(a * Dagger(a) * a * Dagger(a))" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$1 + 3 {{a}^\\dagger} {a} + \\left({{a}^\\dagger}\\right)^{2} \\left({a}\\right)^{2}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAALsAAAAhBAMAAABzQ8d8AAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAzRAiu5mrdu/dZlSJ\nRDLkM64aAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAC+klEQVRIDb1VS2sTYRQ9eZl3mggq7iK4cJdZ\nFHEhmKJuKkKUqjupICi+CK5cVFGXSrAoKugmIIILkS7cdZHQ4hORbgRdGX+AtNSVdlHv97j3+2aS\nUgPBDzJz7jnnnkzuzJcBRrIKU8dHkrNByCLObKCMhH6A5WAkQYNDWjiwFFVGOrBONRo/0oE9jqZj\n84Fd7uuJEGIoNCIKMGhgYZN0h2ngpyXIkNbwedSh6v6BhV0L4VKqUt1CMhSnCRe7xZ6lvFP/wDwR\nmDh8N1RLEasaqA0fCf+Yf20pI+jjgIF5KlBd6O/RhlPWpg1ZMt1bX9dUqW2UV+pkBrbVMHLc/+kI\n4ysMwufEKtfKkPbu6rgVtvR4YOPiNVKigU7buuR7bG1P7lcrQ2LFqXKpZTuw3Sc5Ph5oW3oNY7O2\nIRxvDUBmjgO14QlXSHcZzvDA0hyfb2qt2EKtbF0X2a3P1gAsV5nXhimukAkY7mEQjSdehhN+7iX+\nBfdCG65J+U1QjH/ggPhtNNBLN+4Dp8lukOqT+GNCKwO+V9VRrTf0MX65PX3xpQ8N4GuQXAEWyW6Q\napb4Q0IrA5Z76qjWJH2MP1fWBD1XkdkT/b4Xv4NUHbgKWKTMEr9daDLA+y9+KkJ+Vim0BsRnbqdW\nkW3SvgIsUk6Jfyg0GSh+Th3VaolQWjGMjS9UKjtvVSoNml2A5FqmjlpPGxg5A0BXz7TyuDcJxVsh\nEk8ue3Fjq0j+qXXRUdcOOMQGHe/R3nuQhmOF4qxqphUdDn199ldtDhP5QMkOufizIdp7ciZFyJVV\nM61ofK6NTjPWzD0qaNkhF08PukfDbYO3IqRozGqlzv++YBDfuS8njiJ+7vPe65p2yMXTg+7RcLuW\ntpUVYksm1B053jERJIZMuHeH+LIBw30M5FxsCxwMxJDq+oY4bxwgZ0cCvPMdQ+LSTb8hN+2qgxbG\ny44bHoX+SbM9F8Cvk6RMyWn/jnb51pdekWib4pnHDQ/zMmPa5fXh+zfrmHeGVNXh/43+Aiu0v8FR\nqdTqAAAAAElFTkSuQmCC\n", "prompt_number": 29, "text": [ " 2 \n", " \u2020 \u239b \u2020\u239e 2\n", "1 + 3\u22c5a \u22c5a + \u239da \u23a0 \u22c5a " ] } ], "prompt_number": 29 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_ordered_form(a * Dagger(a) * Dagger(a) * Dagger(a))" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$3 \\left({{a}^\\dagger}\\right)^{2} + \\left({{a}^\\dagger}\\right)^{3} {a}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAJYAAAAhBAMAAADJ4E8cAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAIom7VJlmdt1E7xDN\nMqsI8sYEAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAC7klEQVRIDa1UPYgTURCeTbKbTTabW7Q3QThP\nLI6AWoiFK5z1BUUEFVysxEKCYGNloxaHEARL9USb4yzSCad4AZUTDBKxUZsLKNhGCYIccs68fT/z\nNrdg4RT7vu+b783O7s5bgPyYPdzLT6rM3Pw/mKAQ1ftqR+7qJm4rN2kSfhT+MCwHuU1vnJPicrXr\n/OY8B7v9nIQtl7ZsviNbG+4oZ0W/k1Wm+bONac0o9a7CswpMr8a047sPZQ2yiYa89nSNz1JCUzmF\n4WTaBR+lVugBPCB8F+5nbWHLmCojxGtD51fWhPxdqhVfnY2hkACErxeOZm01vA+FMO1D4EfeqlCs\ni9tJaVB4jmAJoLq9PbYcSM5IQZh8LBzOzUfGtGvvIUEamBFRH+JyTRJ7cfSQkKnctrPgtGExIU1/\ntGKMrEHSVBT0bjI544yhPIGZG6Q9UQlRy08UxTWIJKnGShWmW4rJtbIC633EoWk/RmpNTamDCsVm\nL10B6jGiU4qZVTyjt6wEMYZlTVHWtS4rDwjTdU01eENIHNE9c5964A6RVnSbSHSt8+Q0poe6zVSE\ncH+bHMUWFngExwD/W0jDPyTK0LUOosBMm0PlSEVkB0iqjXCIE3oF5R5S63eja73HDDM1ushFpCLC\n6ipe/DbAhR7cxq9GWYefMl3rJmaYqRGTlSIVnQiKtI/6egyBejTTV2EwePt0MMBbAVBfzGT6SsWZ\nLSjS6cRawU8ojUVX+L7471n3hbW4aTOiG2BIsdoCn/bVWxBMoNg/LpI53/ErbmMm/R2l6CWw2MH9\nNFAbcGnUTGuZcUOu+6KBYiYzblK8d/oIbaeBenn1w/cukby5p0aYycw9E2n3Cl101KhXFbqvqryT\nTOT+6k+qnWJdxw50VBIJ3abWEAT8bPAEfLHYFYspEi4rRKs34oxjcfK1cEcjC3zjzB9yxnHQZ8xr\nMsLgC4bhIic2PsHoboY5LLUNc1oGZ1EpNso5A220YKjLP4+R/w/6C0Jgs38rl/mkAAAAAElFTkSu\nQmCC\n", "prompt_number": 30, "text": [ " 2 3 \n", " \u239b \u2020\u239e \u239b \u2020\u239e \n", "3\u22c5\u239da \u23a0 + \u239da \u23a0 \u22c5a" ] } ], "prompt_number": 30 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_ordered_form(a * Dagger(b))" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{b}^\\dagger} {a} + \\left[{a},{{b}^\\dagger}\\right]$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAGoAAAAaBAMAAACtLdRlAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAELvv3c2rVESJdpki\nZjI6QXVuAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACBklEQVQ4EY1SMWsUQRh9s3p3u57hVgUblQto\nsEghSMBGYcQloI1RuBSmSaceRK4WIQepJReIjYjEJkQFCYoIFrrV1lf4A66wtMgVIQZUfN/MzbJ7\nuyF5cPO9ed/35vtm9gCDRzYcvla7mZoDXJeiOFMklC4/uj0S18aSo60uyEFIKbHy1PS1Ql4EPa56\n9z91Ule4JkcUocclFZyilEBdlNST8bTdSyrF6RnS6oALJ6wsMl7mrwQ6p81z53FAcTUk5l3nXbF2\nxMQ9rs61Kld6mEs/dTvtiER/yKU66rUuSv57lbsCLa4uF044/+4L8I385OMPNxmInCt5+VOm4QO0\n33dQH5DxDXfDRoxX5Cuxt8NAZF3+dVyxavMe/iCIuUlQG6LRwxtA3UB90uazrjN9fLTqcoh9nJC+\nCepzaPZAXh/i+EbR9T3EHat+htqHEp6gso3VjtBjk2gOGF+0WrdarQWR5B91Feqf4ViAL29PJGj0\nweMIdlyWnkRmQh5f2zEN8FfGMaCrywsJmh1M1WJDs649eHPPjPobvKNBgmrf2za0sjExG1g148ID\n/FjsqV0mljBt05xQfV2yXLVfJ1tF19m3v9pd3OXo5zZHregqQ7aXzftxtq7c9dyVaEcmHDGx3JWW\naMcuOGLiUV3uRtZ8VFeu1QGvkdbolOXIIb2iKM6Vm40fzf4HifxwCEYekYoAAAAASUVORK5CYII=\n", "prompt_number": 31, "text": [ " \u2020 \u23a1 \u2020\u23a4\n", "b \u22c5a + \u23a3a,b \u23a6" ] } ], "prompt_number": 31 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_ordered_form(a * Dagger(b)).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${a} {{b}^\\dagger}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAABsAAAATBAMAAACTqWsLAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAIquJdjLdEETvu2aZ\nVM0GsGrEAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAsklEQVQYGWNgQACmBgQbyELjMhcgy3K9OnkB\nic/OXA7jVU0D6Q2AcRkeAVlcCLV/Ubgc30GK4bLMCSBuA5BgVHZNZ+BT8bnAwAMyqlOA6wND/XOG\njwzMAgwM7LMZeBYw3C9g+MzAUsDAwPOdgc2B4RwD+2cGdqBazgUM9QEMbxg4QFYxMNQbMNxnKPgN\nUgXmXmBYxyvwg6FyA5jL58CdxMygzbAGzGNgVzEV8mCocYJIAgB3IikhotO3vgAAAABJRU5ErkJg\ngg==\n", "prompt_number": 32, "text": [ " \u2020\n", "a\u22c5b " ] } ], "prompt_number": 32 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_ordered_form(a * Dagger(b), independent=True)" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{b}^\\dagger} {a}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAB0AAAATBAMAAACetxtMAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAELvv3c2rVESJdpki\nZjI6QXVuAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAuUlEQVQYGWNgAIMMCAUn0fkT4TJghqq2OYqA\nwEQBGJ9R2QHIzINxGRhYE4BsdQSfvwCV3w/Smo6QnwJiItkftmo7A8M+oBhP5jpHBgbGrwL8Bxjm\nAPnNB5g+MDCwf2Tgn8CwEChhy8CtwMDAHcAgP4EBaCb3RwaWBUDrNzD0g2xkYFZgkH/AwMB/gWE/\nyEaQqnqgOv4GoEYwv4BBlf0AA9sFpg1gPusCXjdOoLG7csFcBsasecdWMAAA89EirNLptQcAAAAA\nSUVORK5CYII=\n", "prompt_number": 33, "text": [ " \u2020 \n", "b \u22c5a" ] } ], "prompt_number": 33 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_ordered_form(a * Dagger(b) * Dagger(a))" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{b}^\\dagger} + {{b}^\\dagger} {{a}^\\dagger} {a} + \\left[{a},{{b}^\\dagger}\\right] {{a}^\\dagger}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAMEAAAAaBAMAAAD8lSVDAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAELvv3c2rVESJdpki\nZjI6QXVuAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACv0lEQVRIDbWWz2sTQRTHv7vm1xpLVgUvCilI\n8dCDIIoXhYqhoHiI4vZgL71ZA5WcRWigV6Up6EVE4kX8AVIUETxoTjnn4B+Qg0cPzUFqQcX33s7O\nm0magmAHsvN9b977fnZmNyGAjOV08q+FVharyjKT5hEjbRxZSPt1WZXnHNaueTEFyyjVrmhSGzc0\nqSqKM60qy8ic8yIJ2Kinads4M3tes5kKb7xvplpVtpbO4wQxUoI2xhv2dtUjiA6bQJWushoniJES\npDE4OUe1d7nBGUfOUlAYZBlVWUZmj6BGSkgt8ktUfcrrpGCBPqE5JFd5dR4B1sghiEWFfSzhhLHY\n3oMQdE2RT7BGo4R1fgS3TQ/upaI0pLlg96CKl4sdvtLwCdbIIUjjI6613wdDiOYoqS+zKi6eQLBG\nLqFF9QuvPwKfuZOHIeQbb5ooDyjRe/ItdhTXeIRDd95e4qRjlBJsY/AjrnTxNC2yhOp1/ELUBUoX\ncBqO4jqPsNYNt6RZjYSgjcUhKm08lyK6mD2sxtjBQXpCR/t4B0dxnUsILqI8zUmokRC0sVxHtQ1+\n2jIM4QOCHQSU+RLjKhzFRS6hPESuw0mokRC0Mb+J9eydeZwkl5NkkcoXUeL3FTiD4I+ITEVJcvNc\nkmxykt6lA9OoDqRAjYSgjZU+36cdZg+/QTdHg3ZS3OK9OMrbA+1/NT0BNWKCNqLSoqPUYQg/+QFw\n4TbC+n1f+YQmZopdLlAjIdhGFPqh7JiLaBjCCmbT+Ba+LrVFqnKfQ74zNR+hWqdvjzWSU9Ly4NNK\n6pVeDeH4C9kCcOzV90ZLllS5hKDxrPcSOTpSNRKClrv2pA1hJOuHLsGsPHArhOAmPP3Qi3YPSmZ/\nzu9SlpGGvQm7e07I2l++YN8JU94t7McePID7T8Bf+PfInpLf+j/3MP5/iX6Na/Me8C+6R7etICff\nLQAAAABJRU5ErkJggg==\n", "prompt_number": 34, "text": [ " \u2020 \u2020 \u2020 \u23a1 \u2020\u23a4 \u2020\n", "b + b \u22c5a \u22c5a + \u23a3a,b \u23a6\u22c5a " ] } ], "prompt_number": 34 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_ordered_form(a * Dagger(b) * Dagger(a), independent=True)" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{a}^\\dagger} {{b}^\\dagger} {a} + {{b}^\\dagger}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAFoAAAAVBAMAAAA0iOSIAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAIquJdjLdEETvu2aZ\nVM0GsGrEAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABaUlEQVQoFXWRMUsDQRBGPxVcjUku5BcEjCCI\nEEFNJ4KKltpYiwhid9pZJa1YBFtFSCtoTGWdQhtBjGBvEEs5AiKpFGdub2a9C5li9928L5u9OcDW\ndLRDQRpud0pJwaWEnCpLS0EablfVuL60XQUXEnLKL/u2qSAZt/9TU4C52iFF0F9JdUORbIEWhv5K\nKA55bVri6cPohwk1S+0a353B1WuECcWzXGTlhspPklY1NLm2DzyQel99spCf345GJGlVJ7lUF5ij\nmfz6Xo5h7Ay3fDBVlFZlLpCuA+tApgevxHDcxGOY1bSqdA+jywD9c7qDSonh2cdePK1qvI7KZuiy\nLdTaTOcw37wvBcFBEHwSqaLj3vhAGneTT6X7fyHTNdzRm4hCpY1GJsfGq9I7UJkfpDovTC4dKWSX\nJ3ZHQjPcTLVC+MBdoRSSzESVKS7kN0Jl7mds5Ghlq1i1KBMUZbuDVvk6g3y8fxp//AMYz2ODLKQP\nhgAAAABJRU5ErkJggg==\n", "prompt_number": 35, "text": [ " \u2020 \u2020 \u2020\n", "a \u22c5b \u22c5a + b " ] } ], "prompt_number": 35 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Normal ordering" ] }, { "cell_type": "code", "collapsed": false, "input": [ "normal_order(Dagger(a) * a)" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{a}^\\dagger} {a}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAB8AAAATBAMAAACaQstxAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAIquJdjLdEETvu2aZ\nVM0GsGrEAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAjElEQVQYGWNggAANKA2nMATM4VIQxro1c1FF\nCswLUAUYVNH4DGsJCuiiq0ByB6OyazoDw1GgCgiLoVOA6wMDgyFQAMJin83As4CBwZ2BAcri+c7A\n5sDAAHQXlMW5gKE+AKiegQHKqjdguA+SZ2CAsuovMKzjFQALQFh8DtxJzCA+A5TFrmIq5AEWgLAA\nNNUfGy2S/ZoAAAAASUVORK5CYII=\n", "prompt_number": 36, "text": [ " \u2020 \n", "a \u22c5a" ] } ], "prompt_number": 36 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_order(a * Dagger(a))" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{a}^\\dagger} {a}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAB8AAAATBAMAAACaQstxAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAIquJdjLdEETvu2aZ\nVM0GsGrEAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAjElEQVQYGWNggAANKA2nMATM4VIQxro1c1FF\nCswLUAUYVNH4DGsJCuiiq0ByB6OyazoDw1GgCgiLoVOA6wMDgyFQAMJin83As4CBwZ2BAcri+c7A\n5sDAAHQXlMW5gKE+AKiegQHKqjdguA+SZ2CAsuovMKzjFQALQFh8DtxJzCA+A5TFrmIq5AEWgLAA\nNNUfGy2S/ZoAAAAASUVORK5CYII=\n", "prompt_number": 37, "text": [ " \u2020 \n", "a \u22c5a" ] } ], "prompt_number": 37 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_order(a * a * a * Dagger(a))" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{a}^\\dagger} \\left({a}\\right)^{3}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAADoAAAAbBAMAAADfZYGIAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAIquJdjLdEETvu2aZ\nVM0GsGrEAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABZUlEQVQoFX2RPUjDUBSFT4jNq0laQleXghVc\nhFgiXRwKRXSMi4uDPwiuRVy62E6CWzsJilB3rZ2cRFxcRLAurnbo4CIERByk4Pu7aQTrG3K+c897\nN/clwNgVFKtjM7hdt/1P6jsRpbMECXX7ZP5KayGlJYKR7g+IOxdnhCONp6qW1PTrKnNkz9SQds5I\nMNrac1sLjW9KLyVkVQcgC1iec/w7rZCd8JEKih7ZOQktsqxJJFXeN70Z1941GdNLu8C9cOYdf+SC\nNf72ReH5OvLsCJgXaHeBdAtXHG+FB9gpxK2XBVs9fpEuHji+CA+4X7DKAG8GTDaApyp2OG4Izytt\n1EOFMj0B++RWp3Ufr+qk7Mw+kIkYcKgO1HvoZDzFfCo2hN1/jqfKlp1tU3c288AA13kfeFQlVljI\nrehUfI29ymqhAbzpUlK2yBhNooTeEJtlooTaejwcJIoxxn//PC4lYUoZR/f4AUufQhWqBuJ6AAAA\nAElFTkSuQmCC\n", "prompt_number": 38, "text": [ " \u2020 3\n", "a \u22c5a " ] } ], "prompt_number": 38 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_order(a * Dagger(a) * a * Dagger(a) * a)" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$\\left({{a}^\\dagger}\\right)^{2} \\left({a}\\right)^{3}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAFMAAAAhBAMAAABXdor5AAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAMkS7zRCZdiKJ71Rm\nq90icBAQAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACCklEQVQ4EaWSP4gTQRTGv+Sym80fQxAbq1xt\noQEPEbRII1bCFlY2t3KKCBZRtIjVgp0gicXpFQp6rYIByysuNqLXeP5DxeYa9UCFNFef7+17b2bJ\n3lUO7L7v+30vk5mdAQqjtnS5wPYBK/i0T1LA2+ikBbg3WMVwfjapDT7PIvHr8Sy/hqVZJP5XAV/F\nuzz7YKaWmMrVS6wPKqDWaiZfK8iX4Cm5UlfRMlDeJF0eldv5LtbBzT69K7HwhRPPgEekD629VCSB\nvHlbVxTEy9TQoufF7m6GShNJXmWlM0a0IwB4T6KamAPuqDzQBq10OIHf7imKoqlvPWOyB2xjI0Z9\nbIRb8cccqiOTA+Dw4CvQodXJ+M7FH0o9FQxcULFhANkR3Hb2qFMV/WM+hejb9R/ARc6OuT954ALb\nznEiR9K5KbDCrZ02v3mcpkeCZo89cI6O4jnCLnCLrb9/v13Q2OIE+AmEO2j1gZjtcMxvHqsuKE2F\n0Kz1Lhbb4nKzUqsGudbFEdZlTlprqr8BLUCD8pawj0TGWGhoi/8CtC0NbFv0ISv95t+aTuY/82MX\nhImENE3w5f69G9rqT4uOQIPKvIR1rdp6Vivdx9TkXRXhyAjXwF1JNBMLHqooPTHCtbnp3UmVQc9Y\ndqHMtOz7ErCrPZdaet4E17c5E03EvHGskTiJqOv1XmrNwzD2+n/UP7E6bsVCQanNAAAAAElFTkSu\nQmCC\n", "prompt_number": 39, "text": [ " 2 \n", "\u239b \u2020\u239e 3\n", "\u239da \u23a0 \u22c5a " ] } ], "prompt_number": 39 }, { "cell_type": "markdown", "metadata": {}, "source": [ "Wick's contraction:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "a * Dagger(a) - normal_order(a * Dagger(a))" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$- {{a}^\\dagger} {a} + {a} {{a}^\\dagger}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAGQAAAAVBAMAAABCslYDAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEM3dMiKriXZE77tm\nmVQzv5s6AAAACXBIWXMAAA7EAAAOxAGVKw4bAAABS0lEQVQ4EZ2RvUvEQBDF3yomaswRBS1sIsFC\nEAsRRKwCYp/qagvBs5E7UbA8QRC7q8XWSpHjej/Af8FKC9MIdp4g2ImbWfeyO9nKbfLeb+bNJFnA\nOl7Hsg6zy9k/In7Eh3DfYiBYfM4ZYrZ3e2MT4U/aoOKiFn8PL600MbDNPIKcE+7vOGCRaV4HKhEv\nt5reLUdmjyN2L46IeZX1o40IYSqHkKJhOkJkZOdkGXgqt4xd4h7wM0ApM6LIeRb0gcMyMvuAF2BU\n/nWlzAgRcY2wCxwDUyvFmcdrhDVAyE6lzAiR8BPDbUDO1OcK4ktprfaTZD1JliQkMt5FnOru4im+\nUesXOwwFqM9XtbiJD3MHxA+CuTeKDNQgQiTO0atlRYc+C3jcapIp1d8WEBlqT6z6upueM6ebjQ5T\nOkI10Tion1kRp9FX6Sy64YUL/wJuV1aA6E8ryQAAAABJRU5ErkJggg==\n", "prompt_number": 40, "text": [ " \u2020 \u2020\n", "- a \u22c5a + a\u22c5a " ] } ], "prompt_number": 40 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_ordered_form(a * Dagger(a) - normal_order(a * Dagger(a)))" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$1$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAPBAMAAAArJJMAAAAAJFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAADHJj5lAAAAC3RSTlMAzRAiu5mrdu/dZmiL4QAAAAAJcEhZcwAA\nDsQAAA7EAZUrDhsAAAAjSURBVAgdY2BgEGJgYDDZxMCgEgYkGNhJJVgzdmYB9TEwAACPpQrvlUCH\ncAAAAABJRU5ErkJggg==\n", "prompt_number": 41, "text": [ "1" ] } ], "prompt_number": 41 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Test operator ordering of fermions" ] }, { "cell_type": "code", "collapsed": false, "input": [ "normal_ordered_form(Dagger(c) * c)" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{c}^\\dagger} {c}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAABsAAAATBAMAAACTqWsLAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAiXYyIt1Uze+rmRC7\nZkTTotXTAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAfUlEQVQYGWNgAIN5EApGonGlYeJg+vipNmT+\nBukNyFyGySg8hmN4udNQZZHsFVQyYFgMkgUxGFwT2AsYRIA8MIOhkYEzgUEbyAUzuH6D1AFdAWFw\nHABxgQDC2C8A4TFAGPwXGBgSQCIQBtcEhl1A84F6IQzBuwogHtBaIAMAohMbe/npeTMAAAAASUVO\nRK5CYII=\n", "prompt_number": 42, "text": [ " \u2020 \n", "c \u22c5c" ] } ], "prompt_number": 42 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_ordered_form(c * Dagger(c))" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$1 - {{c}^\\dagger} {c}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAD0AAAAUBAMAAADM7ygkAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAzRAiu5mrdu/dZjKJ\nVEQJ2sCdAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAs0lEQVQoFWNgwA7ysAvDRQnJH4KrxMpwdO3F\nKg4TVDikAGMyCMFZSIxsONvkE5yJxPCFsVXC8MszsGOVz4XpxyGP8D+m/jPlGxiiQfpBDEz9lhcY\nBRgOA6XBDEz5Hga2CwxFQHkwAyrPJDkTCCYCzWMFu1cBxsDQz+EA1AoCUAa6+/QPgGUZGKAMdHn+\nBQwMF0BKoAx0edYEBlWgM4D2gxmsGT+zQDwEOLOqAMKBMxByGCwA394vqiwGFSwAAAAASUVORK5C\nYII=\n", "prompt_number": 43, "text": [ " \u2020 \n", "1 - c \u22c5c" ] } ], "prompt_number": 43 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_ordered_form(c * c * Dagger(c))" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{c}^\\dagger} \\left({c}\\right)^{2}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAADYAAAAbBAMAAADFWWEGAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAiXYyIt1Uze+rmRC7\nZkTTotXTAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABRklEQVQoFXWRvUvDUBTFT2xi0qbRVJxahKij\nS/4BMYuj4CDOWXTuVDepIE4OBcFRCk662E1wsUNRqIu4CIJQEXcFN9H63r33lVhJhnfO75x83JcH\n5FzVfiengZUU63mdkxQ+pTsZv8cb2D95HTD5JV1t/DnAiTi77R/8K6uSdGo88DJxECsJ2tLhiIzd\nZdb0glcG3JC6sl0XKDS27/5080ITIbzh8F3omHRfyG+KIaG9T62bqGFMZSHGqQarrZeZRcDMv5q6\ndczqrnwP2JvYAR41qmsPxRRL2jkp4IVQ397SCJTot9Hw3gC4ILdCFbwuq1p1d0gk3XU46tQ7/Q+i\nN86m1QApWz3Ltzqc0SylFq5i7qwWcAZf7eecA1SeI3F679bcg6JdSTKyId5uZkKxT6JWJCYj5YTh\nMpMZa862Z4KsrhEECWe/nnM8h0OEP9sAAAAASUVORK5CYII=\n", "prompt_number": 44, "text": [ " \u2020 2\n", "c \u22c5c " ] } ], "prompt_number": 44 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_ordered_form(c * c * c * Dagger(c))" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$- {{c}^\\dagger} \\left({c}\\right)^{3} + \\left({c}\\right)^{2}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAIEAAAAbBAMAAACpc/FGAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEM3dMol2IlTvq5m7\nZkT3Gyx5AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAB/klEQVQ4EX1UPUgcQRT+9uKq9+PF2ASxyLmk\nM0Ug4E+3BKw9AiooggQv9UGqgOBWIUUgTexEkzRamqCFYkg6K+EKSRARD6wDWqQUffNm3u3OOs4W\n773vZz5m3y0H+J+w8dVjCA++e1Qt/cSBxzOLbx5VS7s493jGMNW05VLbxgr9uEt1mHWstDuAB0dC\n8Nm25NCnfpsIcxgIXi/alhwatXHl2V5iM4R8m0S4bfuD8BETXS1ux1ynEm5pyaqnKa2nUsx9uYNo\nCys6TlOqpiqq9WqcCmqqJIyHuQI1YAwn+d1k1JcfPuZUndBdNwkNYLKxacBj07Pqxs2NYaWVEjUV\nmwYPms7tvQFuVZz6e7gQWEhkoi4JblUZw5kllGM1zasy/Sa2fytJcKt0omccEUK+/xHBt0mhhr4a\nTfJIglslV7GOLXTzZscJroJ20vtcjlOXhDvqwAv1PMUvdTjgE+tA+UpNXZeMdZEEt0qetdRMnuJv\nBdOEV1E0EUUjinSoikbwnxsXuueTupqq97yFQyX3NdDL5wHa1cMWkNy7SYdKR/cR7JiEOdrDFwzF\nKG8bRjXZg1slQ7jwR+zqm5k+WwQKbaGoS4JbzRhpfNA0+F2WlwS3mnUCfXL5mSz/zwC3mnXSfKhx\nUNM9V/2qNpv/kIq8jR3hV7W3p8X9r31SUE69BbiCbVrFGobUAAAAAElFTkSuQmCC\n", "prompt_number": 45, "text": [ " \u2020 3 2\n", "- c \u22c5c + c " ] } ], "prompt_number": 45 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_ordered_form(c * Dagger(c) * c * Dagger(c))" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$1 - {{c}^\\dagger} {c} - \\left({{c}^\\dagger}\\right)^{2} \\left({c}\\right)^{2}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAKkAAAAhBAMAAABQGJapAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAzRAiu5mrdu/dZjKJ\nVEQJ2sCdAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACpklEQVRIDb1Vz2sTURCebLLNr02MIoq3VRS8\nmUMPempEvRSEKqUKHozgQZSKeFGoBw8etSoiolAIiCjqIf4DJrRoofSQg9dirp4s3hShzrx5897b\nH9GEFB9k5ptvZr7dnX37AjDWCmbPjtWf3rwCl9ITY7FPoFMfSyC1eRGm+rHEtgzlaxhT3ZahPIuJ\nwt+GMtGPV0fi6xIFM4LEpwxFUjBI9SNXoGpeoVemw4LEUEwqCA10QbnB0TJAtYmw2q22mXFsYiiS\ny+0+3xPs+kyoouOnHgCsIfyw8YUZRbNJDkWSXnBAYMSf4yhcDgGK+Hu4taWYcku5d2R5KLsUETMT\nyQfDiuwPXXYNfd55UZPMUxcPZVIqdQO7XOoAzMOdxqrspu2QO6vpoRycG0G1INciVXhhVPNdDe/I\nUPKpqhPSbzoJdEIdzpOf1QFAoa7hYaEGqPYl7/o3Eqiv4LZE8E1QRm4mqRqsLoDfxsL1W2SddYYw\nsRcIfA/J0vpEhngz+IRqdgl2QoDPdKyXqVG5XScRKnaFuI655rTwJWlIqBa6MA/5EOA+xKe7B7sV\nexOBcwguCV95RAlcrOrte47rMV39YojGA/D5NToZeCoslcBUjyytReHLm0xoVR2Qu6dxoaGBdXiv\nDmsPbFRlfqCq91urHOlaOY1Q1WHtnwtOgPlqdAKOwC+ACoU7WgDmGTl/OcLaPTAt/OC3NQee2jh+\nEw61WU0s7lCHNbsXPgvvz3Cpf+XnVWliH6y9ZrD+9kY0o3aoZe23RV+B4jP9WMcwYSHStNe0FOsa\nHjXUCMDvOsWePUBK+sFh1ckPDct3ndJS0wYnGHo1S42A1Fml64tt26hP7ZxMwmaGQfudovcOzrZU\n8NKhRoAVGSD+FTRG6PtH6YbJ+6GB/wn8AUu6nGwnjG0GAAAAAElFTkSuQmCC\n", "prompt_number": 46, "text": [ " 2 \n", " \u2020 \u239b \u2020\u239e 2\n", "1 - c \u22c5c - \u239dc \u23a0 \u22c5c " ] } ], "prompt_number": 46 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_ordered_form(c * Dagger(d))" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$\\left\\{{c},{{d}^\\dagger}\\right\\} - {{d}^\\dagger} {c}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAHIAAAAbBAMAAABSCMbcAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAMolUmc0idhCru+9m\n3URozekSAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACGElEQVQ4Ea1UPUwUQRT+3DuOueXuoLL1wEQo\nJNlGW86Cglh4BYZAINmWwnDYaGW2sNBQHD8FFYREqCwkaCwMxXY2kBAIBQXJFcQCC39oKIjxvdnZ\nmd2bXSsn2Xnf+7733vy8yQJZYzOLVFy5o8VbdzWMAWdeDMRe2iYyx/20RN4IfaUZi5aEE8R873WM\ntN3Z/ki4r66JBHBnHnvKLTcTfASDkYCAawvECudNFAR0Z9beN7DCYrfA3OUnlPX5rYB+D+/yMnEF\nN96sXfpHkJ9Zu/5X5iiwlremc4Ry/pqTgHwJ1jGoXE8Dpp/uFi8w9CI6eGl18Qp4xJSdOT98x0OR\nA53hRWCpReiZ19PkaHz3XervPYaV7kbXPuNDAMenV3KCpyjR5oA9tX2xjyKVeMkcRrl6YiyFGAd6\nA/lI1nDok1aMyxOo1gESaYgpnubOaZxykScBjomIEFCYJdS3RRMPAu2ORDQ9CGMU2S8Qf2LEdsED\n2vWIYTCmVkTtlyKVEb9R+MkrghAPvtv+EKACVMLDTsFnZN+toPfTfCilG9prFFBcxuuBdpP61aqc\nOVK0MzGFw+W6FCcgqHGybUMHLVTpmsT64PyrvMy3z2+vd6To3P9K1jT8m0pRxghpXnsmINScBEZI\n89rTASLUnARaSNPG0wEVw0mU/U9IBDm7CScJq42kl4WngywW2MjhTXRB/juMr9BlaFH/ifgLXcto\nxkcUjs8AAAAASUVORK5CYII=\n", "prompt_number": 47, "text": [ "\u23a7 \u2020\u23ab \u2020 \n", "\u23a8c,d \u23ac - d \u22c5c\n", "\u23a9 \u23ad " ] } ], "prompt_number": 47 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_ordered_form(c * Dagger(d), independent=True)" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$- {{d}^\\dagger} {c}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAACwAAAATBAMAAAAZhvJKAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEM3dMkS775lUiSKr\ndmb9QEdWAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAvElEQVQYGWNgQAE8AShcGAeHMJcATAEyzabW\nPgGZD2UzcgliioZVMPA4YAoz/GRgw2IG60eswlwGDDxYVDM1MGC6e89a/wkMHCArudZegVvMWs2Q\nL8DAtYGBgduSQQkuLP6AoYmBgVeAgYF9AcNJBiFjEFBh6BdgsGJgYAQqA7IQoIyB8SuEV4YQZGD8\nxcD5AaQWxEIARqAPFWaD+f8YGDjhEroMjw8sAPN6GBhb4MIyt7zPBoB5XOveMgAArhUjIYzwxGYA\nAAAASUVORK5CYII=\n", "prompt_number": 48, "text": [ " \u2020 \n", "-d \u22c5c" ] } ], "prompt_number": 48 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Normal ordering" ] }, { "cell_type": "code", "collapsed": false, "input": [ "normal_order(Dagger(c) * c)" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{c}^\\dagger} {c}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAABsAAAATBAMAAACTqWsLAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAiXYyIt1Uze+rmRC7\nZkTTotXTAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAfUlEQVQYGWNgAIN5EApGonGlYeJg+vipNmT+\nBukNyFyGySg8hmN4udNQZZHsFVQyYFgMkgUxGFwT2AsYRIA8MIOhkYEzgUEbyAUzuH6D1AFdAWFw\nHABxgQDC2C8A4TFAGPwXGBgSQCIQBtcEhl1A84F6IQzBuwogHtBaIAMAohMbe/npeTMAAAAASUVO\nRK5CYII=\n", "prompt_number": 49, "text": [ " \u2020 \n", "c \u22c5c" ] } ], "prompt_number": 49 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_order(c * Dagger(c))" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$- {{c}^\\dagger} {c}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAACoAAAATBAMAAAAUmIINAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEM3dMol2IlTvq5m7\nZkT3Gyx5AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAiklEQVQYGWNgQAZcD5B5MDZ2UVYBmDwSzaOz\nswGJC2UysgpiCjIwcDlgE+VpIF6UC6taTPeyhqUwcDsAzQUxYIDdgkGJgbWAgQHMgIlyBjCsYGAD\n+g3MEDIGARWG/SDPMgIxmAFTOweDAVL1FSoKZ4D5fxkYOFAZIN4uBsYtYFE4A8Rjjb0GFgQzAO18\nGLDF/XLYAAAAAElFTkSuQmCC\n", "prompt_number": 50, "text": [ " \u2020 \n", "-c \u22c5c" ] } ], "prompt_number": 50 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_order(c * Dagger(c) * c * Dagger(c) * c)" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$- \\left({{c}^\\dagger}\\right)^{2} \\left({c}\\right)^{3}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAGUAAAAhBAMAAAAym3iGAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEM3dMkS7mXYiie9U\nZqsqREkJAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACJUlEQVQ4Ea2TvWtUQRTFz375srvZuNiksHAF\nCysRLDSg8BBsbDbgH+BioQgKq0gQQYhWsjYLgo3FbipNQEmRNEHwVVYBtxBEg7iKCoJF/AvivXNn\n7sxOHmvjwJs553fefLyZN8CUUlu6NSXNj1bxLT+YQhfQ7k+Jc6NNDBajoNb7GpF99l0zQvexFJF9\n9kxM7uFLjMT/cLjWdcq3t7006oJ46jNj1IcoJ1vYmGTljvgVoDImWRlWUmrCUni4HFqgKF985dpr\n4CVF57ffxnuAeA/uyhDNFXqzRM+bvT1DyiPTvDd1OzONrap/rPhO7UzXR09FzqX8NQMZwKa6SzcI\nVHd9n6NWtoAF7DR9ANQz67gPzllDUw6t7AEXe7+Us2i7EX6z8+dd77OncliasN5xxpzpY+dwyali\n5pS25oTXHqW4w+iymxXP2TLXD2Yg5So1T7JiC6vs2ynXXG7SY3ijxXainCC3hbkMDxj7a3DW8dmT\nHACHTnE5xvI0kJgjMqsaZMy4bDpe3hUQ1DRPvaPez0N9hOf3OTLUPv5a09qEV+za9B3gJ3BwBGSC\n/L7RHgjP2QM6kWSM+VT66GnhleNJV6Kg5pHXPi9b4v8DPlPDi4vB2yLrE+i45qW+lc8UqUiGKukO\nu4sBNLqWvwhyK8vrAWuMvbkustDySJX5n60rpYph79wBt0af0D8RmE+Bro6M+RgglbNu4XRNO0r/\nIbY1T5oq/4v4C3WYaoa3V/8gAAAAAElFTkSuQmCC\n", "prompt_number": 51, "text": [ " 2 \n", " \u239b \u2020\u239e 3\n", "-\u239dc \u23a0 \u22c5c " ] } ], "prompt_number": 51 }, { "cell_type": "markdown", "metadata": {}, "source": [ "Wick's contraction" ] }, { "cell_type": "code", "collapsed": false, "input": [ "c * Dagger(c) - normal_order(c * Dagger(c))" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{c}^\\dagger} {c} + {c} {{c}^\\dagger}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAE0AAAAVBAMAAADx+n4ZAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAiXYyIt1Uze+rmRC7\nZkTTotXTAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABGElEQVQoFWNgAIN5EAoHyfkAJkGsOmmYBqw0\n4wao8PFTbVgVQAR5alYkQFgbpGE6sCnnZtwNE54MY2ClOQ1gwsdgDKw0TwJMGEUdtwNMGEoj1E1D\nlmFTQOYB2ZwJMAGU8MNU9wCkTlDJgGExjAGi4epAMoxCygxcIH+4JrAXMIjAGMjqQDIsYQzlDIwO\nQOFGkPXaMAayOpAMhwDDNAYmYOhy/QZJwRlI6sAy64EyDNxAzHEAJAUEUAZjeXlpe3n5AqhAD1gO\nSOwXgLLgDJg/QALcH2Hq+C8wMCSAOHAGTB1Y4C/Q+2ClXBMYdhmAWHAGTB1YYCUDNzjMgMF3VwGs\nAcGAhR9IhlH2EkQWCwlTh0UKRYgP6GR0AACsszrw459K0gAAAABJRU5ErkJggg==\n", "prompt_number": 52, "text": [ " \u2020 \u2020\n", "c \u22c5c + c\u22c5c " ] } ], "prompt_number": 52 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_ordered_form(c * Dagger(c) - normal_order(c * Dagger(c)))" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$1$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAPBAMAAAArJJMAAAAAJFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAADHJj5lAAAAC3RSTlMAzRAiu5mrdu/dZmiL4QAAAAAJcEhZcwAA\nDsQAAA7EAZUrDhsAAAAjSURBVAgdY2BgEGJgYDDZxMCgEgYkGNhJJVgzdmYB9TEwAACPpQrvlUCH\ncAAAAABJRU5ErkJggg==\n", "prompt_number": 53, "text": [ "1" ] } ], "prompt_number": 53 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "States" ] }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Boson Fock states" ] }, { "cell_type": "code", "collapsed": false, "input": [ "ket = BosonFockKet(2)\n", "\n", "ket" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${\\left|2\\right\\rangle }$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAABMAAAAWBAMAAADQs7pMAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAVCKJRHYymbsQq+/d\nzWZtGdnkAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAoUlEQVQIHWMQYgCDB0DSBMIsATOZyjsSGLLA\nzFkMzF8YeCaAFKxkYNjNwPoAxNzDwLA+gfMCiHl/ApDJ0AQ14fwEBmEIk+UzAwMPhMnTwMDA7gC2\nogJoKNsCEJN1AZDJaABiijMwKTBwKACZbAUMrAoMGiBtOsbmaxgYDEHM+////2FgOABiggFLAZzJ\nlQBnzgXKQRU8BTLDwEoZOiEUlAQAd+Ag08QZt+sAAAAASUVORK5CYII=\n", "prompt_number": 54, "text": [ "\u27582\u27e9" ] } ], "prompt_number": 54 }, { "cell_type": "code", "collapsed": false, "input": [ "bra = BosonFockBra(2)\n", "\n", "bra" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${\\left\\langle 2\\right|}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAWBAMAAAAyb6E1AAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAZjKrmUTdVIm7Is12\nEO9EeINyAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAApUlEQVQIHT3MLQ7CQBCG4RfatNCmDYfA4HoE\nEoLAVeCphBsQVE0THASJQqBQPQI/DlWP4Qz4ZpmdTTrJzjyZzH7ACK0d9DPHCvyc6+IEwoAk45Bb\nbvEa0q/lmbTA+wmjmrh1HGhW0Mo20KhVKVwqNzZsbukfLR+WL3kVH+nhlJtweIExvIVhSbTezwoh\nBbExRqkR+o2JDFtyEDcde/eOSe34dEP7H+J5JnA4wY8wAAAAAElFTkSuQmCC\n", "prompt_number": 55, "text": [ "\u27e82\u2758" ] } ], "prompt_number": 55 }, { "cell_type": "code", "collapsed": false, "input": [ "type(bra), type(ket)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 56, "text": [ "(sympy.physics.quantum.boson.BosonFockBra,\n", " sympy.physics.quantum.boson.BosonFockKet)" ] } ], "prompt_number": 56 }, { "cell_type": "code", "collapsed": false, "input": [ "a * ket, qapply(a * ket)" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$\\begin{pmatrix}{a} {\\left|2\\right\\rangle }, & \\sqrt{2} {\\left|1\\right\\rangle }\\end{pmatrix}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAIAAAAAaBAMAAACN7UndAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAMkS7zRCZdiKJ71Rm\nq90icBAQAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACaUlEQVQ4EZ1UO4gTURQ9SWYmk29hITa6g4Wd\nbEQQu91OG2EKK1E3uIqFLMbGH8ourIqNuKQRUTDgFnamXLGZVkGJWFhYbERULMSNmGVlCz33vXkz\nbzYikguZe+8555689+YDYBv+L/zfEmu2uCVNrmFD/6hrwQi5VxAnjPEVnatxO5JuaMSWlSJiZ42y\nrQsvMMCWfE73GdknwB8aHZlbs/uQ6xkgm92+oiEGXLWWXQRKTaNrw+3hUQC6/i28rqZp4E9x20p2\nFyh3jbqNWohyB9cMkM0nY5r/c2CVBkpWjzDBWkcb5T5qAxw1QDY/jGnZwjyHlMxr4GUia8MZikFh\nIYGsgkegaWOgZMUOTovozr1doTod1IeoLFlzSVmMpCRtDJQsP8R+wvknmII2mOR0X6R27GZTVwBp\nY6BkuQGOkDgWYTY2+Mj2lNKml+Iy60uqJ50YiMz/gc9M50N80QwPBdiptOnl5nwQL0voxEBk/qZa\nwWO4A81cl7FncrFjpoGqOhihEwORcQXcgvsLlTVXmEoTt4GD9rDU3gbqIbOiEwOR5TbwlgabKEyv\niMF24DJ82UYm/HW8EEDRxkDJeBeukjiE1z05Xv/r/bk+Sl24PzMGWA3lwdW0MaAMqHYwybWduLLj\nXUADhx+Mvrph32XFaUw8aLLRNA3mnn6L9H3lqZYDoxNriT385RekSsJZTg1tGZwWvCUjM8wbAlu+\nKpV1I9J3QTqRYYbvdUcKidjAnWZ9XAArDqe1LcMr4u8NFzPVFoHIgKPZluED+eTtvaDFhXS7o9NE\nbJl6vPh0jB2LavL52PM4M/5oMvkHt0um6w93xAoAAAAASUVORK5CYII=\n", "prompt_number": 57, "text": [ "\u239b ___ \u239e\n", "\u239da\u22c5\u27582\u27e9, \u2572\u2571 2 \u22c5\u27581\u27e9\u23a0" ] } ], "prompt_number": 57 }, { "cell_type": "code", "collapsed": false, "input": [ "bra * a, qapply(bra * a, dagger=True)" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$\\begin{pmatrix}{\\left\\langle 2\\right|} {a}, & \\sqrt{3} {\\left\\langle 3\\right|}\\end{pmatrix}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAIAAAAAaBAMAAACN7UndAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAMkS7zRCZdiKJ71Rm\nq90icBAQAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACk0lEQVQ4EZ1UPWgUURD+7i57t/fj5dDGRrNY\npBMP0wQsvMafRnKFlRhz+BMLC89GUQIeqIWFelgo0SCHRhALSSUGi2wnCkpAxEIwZ6GWJsGEhBPj\n9+17e1k1nJKBnflm3sy37828XQAb8X/irkhmo8lVObFiNNQBb/D+WtyuSFeZKmfWsjVj19SXw6hv\nwDMgLXhS7hYpBrzArK1O2XBs2oCbNJ8Bd0HuUbjDfYWOBE4TV0d3MTfpGSCCs3xphRZNDCI935Eg\nOeFWMOUDeRggghtAZoI2W8c74HFHgiNItdDdBCYtEEHeR496mKjhCTBT6NSDMcTvY6gE9FsggmQR\nr2jABg+UOxOwBRQewS1ZIIJUA8fljknhW1k7uHZ7qzb1p6R8Rfba0QmIIL6APsWbUvFl9SD+CLvl\nRWUbnTyf2L1KBIggNocDNHHGuVIUwSEfx+RFJDVO51wQuFNAbwhE4M7jCw0nS2EdCU6X8VVeRK5c\n9OwmkXnIKyMhCAhawQ6C86V4wUjwAM5ckBJRQ0Xk6nxdDYkWRkJgd6AjOCWqp0xIe84ysrNOpFgw\nuYQ8G9u9gMQPHAxB0IMlvFVGP9tRQUoELSRK/Ex+E3cRLxnIFJFfQqJmgQg4hQtKnQSuj976qCPs\nw5vpuvNd0VWZKfOrQc7HVFW31gAR5BrYoaFzRgMrKz9FMHh+83uPV2K1mqjnbkV+7/BO6qYFIuBN\nzHiyUhQSGInXLDCmazxCaMZgLlJXFck6c8K/UpvA/mBCluxiiGg3WawdDJURa8jfIxXZwWHjt/X+\nNrK/MPoieM3ng9ZeSEUI/MBdW+WqJi6CT3w4V6v4cRXk/EOckkk4wyHo/NmK8dejLwVFz9dTampO\nrL+0XfkL3EGg4raQe50AAAAASUVORK5CYII=\n", "prompt_number": 58, "text": [ "\u239b ___ \u239e\n", "\u239d\u27e82\u2758\u22c5a, \u2572\u2571 3 \u22c5\u27e83\u2758\u23a0" ] } ], "prompt_number": 58 }, { "cell_type": "code", "collapsed": false, "input": [ "qapply(Dagger(ket) * ket)" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$\\left\\langle 2 \\right. {\\left|2\\right\\rangle }$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAC0AAAAWBAMAAACmiQjHAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAZjKrmUTdVIm7Is12\nEO9EeINyAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABIElEQVQoFWXQIU/DQBQH8D8r60rbLfsAiCZg\ncFU4QhNAzE3gqQSFQSAnSJiD4CAhqSAkoPYNBsGhLkFiUEgECQSzHP/37g7EXtp77355174WQB8h\nOo2rVFplYCRDV+5IWhziZnChQE+3LwusyC5Gt8SZdtJfkHwhNvRjRAa9N2mhbwAfyPvcXKFXI/r0\n/g5sFt0JkE6Qzf59aujsRSJnEM98P9Oh4bP5Wom9kaw6Z/tHcVcAB7qqx+c6u/sG1gz1AQt+66PA\nkyzO85JFZ4RXSRXugx8hbbCkF1aBZ++tCnmDOz2S7o+3au+345N14JS7Gpm1NvjU2m8xQAdiZug8\nzO2KyxpvH8GjgpCZwH/9MiMWHuZ8WUR+qo+8cMV1gPn8C/ofPWSWdkkOAAAAAElFTkSuQmCC\n", "prompt_number": 59, "text": [ "\u27e82\u27582\u27e9" ] } ], "prompt_number": 59 }, { "cell_type": "code", "collapsed": false, "input": [ "(Dagger(ket) * ket).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$1$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAPBAMAAAArJJMAAAAAJFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAADHJj5lAAAAC3RSTlMAzRAiu5mrdu/dZmiL4QAAAAAJcEhZcwAA\nDsQAAA7EAZUrDhsAAAAjSURBVAgdY2BgEGJgYDDZxMCgEgYkGNhJJVgzdmYB9TEwAACPpQrvlUCH\ncAAAAABJRU5ErkJggg==\n", "prompt_number": 60, "text": [ "1" ] } ], "prompt_number": 60 }, { "cell_type": "code", "collapsed": false, "input": [ "(bra * Dagger(bra)).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$1$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAPBAMAAAArJJMAAAAAJFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAADHJj5lAAAAC3RSTlMAzRAiu5mrdu/dZmiL4QAAAAAJcEhZcwAA\nDsQAAA7EAZUrDhsAAAAjSURBVAgdY2BgEGJgYDDZxMCgEgYkGNhJJVgzdmYB9TEwAACPpQrvlUCH\ncAAAAABJRU5ErkJggg==\n", "prompt_number": 61, "text": [ "1" ] } ], "prompt_number": 61 }, { "cell_type": "code", "collapsed": false, "input": [ "Dagger(ket) * Dagger(a) * ket, qapply(Dagger(ket) * Dagger(a) * ket).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$\\begin{pmatrix}{\\left\\langle 2\\right|} {{a}^\\dagger} {\\left|2\\right\\rangle }, & 0\\end{pmatrix}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAHYAAAAaBAMAAACQv7UDAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAMkS7zRCZdiKJ71Rm\nq90icBAQAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACYklEQVQ4EZ2Uv4sTQRTHv7nsxM0mF4KCnVwq\nC0ES8RBBhPsHhC0shZy/EAthT/AQ8SAgiI3cuniolbHWYkvFIqkF8TwLEZuIKFqInriiiMTvm93J\n/rgDIQ92Zt7nve++mXnJAtiJrbaxFRWIJ36pU6Di/l+7X9Isl8NQVsDjeALWUqduWH6uDumf41Na\njwNBPGH+0EMgcSqtBBamD4AdkTF+/fSBSTrcNW6GWoHmvalUnV9uAstAdZGwAbWO+y1TCnhJGCSQ\nBfJmheoTsAo4IQNPMOvC6afaI4RBAq/mlcAz4DbrDTHH3eEwnBFmN4vaGB4vao8CAxeVjrwE9gKs\nKKd9SxoksNwriP8C7RA7+jjDgL5vNCKpa79Z4gE3tJYDYc3Pa9VPaj3MRDgoCTrY9kW7r1f+Bpwk\nocMkCkeySM3+Dcz5KG3iGOFeHXgv6eqRHAR3SbSWEKd0eDIkWvs7PpqgSAJUIjQ84BKpaAViD5+M\nKdblnu0/uq7uwgrDAZwOuk3A1Q4gkB3MG887CMG6smfpQm0RN6jt+hhopa6rITuYN57jhYvSL7wi\nly7sBi6LNsR8jS6Ne9bQln1n7QqkO7xnLqQL9ud7F0ZMt7z6l2qcGCSwGkL9yGoboXoA1Ptoy9FG\nsMbjsWjV61s3LxptDKWDXyXLmLqz0tTX6LSITBd0W0yKcaSDMz1DJ7PloeLT25UQk65d48h/apsP\nQJfX1WdIfzs4m3QuJ45a4PqEgLw9pys/+7oX8+20OjaM49nxHR1prn4356VsMHHK2WtK43U5K/s/\njV3ToqfTSHF2KtVE9A8hO56Tt5hb0gAAAABJRU5ErkJggg==\n", "prompt_number": 62, "text": [ "\u239b \u2020 \u239e\n", "\u239d\u27e82\u2758\u22c5a \u22c5\u27582\u27e9, 0\u23a0" ] } ], "prompt_number": 62 }, { "cell_type": "code", "collapsed": false, "input": [ "(bra * Dagger(a) * Dagger(a) * a * a * ket).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${\\left\\langle 2\\right|} \\left({{a}^\\dagger}\\right)^{2} \\left({a}\\right)^{2} {\\left|2\\right\\rangle }$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAIsAAAAhBAMAAAAbsEVEAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAZjKrmUTdVIm7Is12\nEO9EeINyAAAACXBIWXMAAA7EAAAOxAGVKw4bAAADGElEQVRIDb1UPWhTURT+8vfy8ktAcdEhogh1\n0ODgpBiwgh3UoCJuBicVxQxFxSlDxQ6CQVwUihFF0KVZpAhK489QnB50FLWLih2kFGqLEOK559xz\nn0mF1A4e2ne+c75zv5xz730PGGRjd4NBJWvg/WastYayQSVeM/prUM0a+HwlvbSqbD2DJjv9Musa\n1Gv3y/zDoLGKLh5T4PxfB3Usg6hdbmTaJhMpm2efrR60r2DIxn4AnDD4NI73lVDotenRawUJr4t7\nJS714mgNPlHRqasTvfUm4kGTTSFYIFqS4Aa7eFuinP+RwCUg3+0ucGqrEJEieRnUr0jqkHHxCh6P\n3AFEZjIQCrEigXc2IJduWLyHvAxKMunhe0VsM4yHXAm3K1bGHUuqRtykKRDLqH7GDUoys/CX4Bnq\nGmIB8nNW5psuYxmvoCFmFGXrOijJ7Ad+IGuq7iNfRWxRZKIdrY7VCMUbGmJeUW5OEcl8BQ4Ucy2a\nuYVMx8lEXA1fv6wLE1VdjClFJDMdkAx1wodKG9SRbuIkjEe3dgSIFwklXHN+WQk5bIpAMmSXA9oX\n2mFjZ+oik6IpEvN4QDVNSkcXDWksVVACmyVjZRIrrHGSk+ftgWdKwKcCRoBsQET4jfBqSuBKj4zX\n4Dsjd4cw3xuvDBwLcBHImeL0si7JV5TAbs3xUPSLoBv82iTf0j/LmG6+I6ezhN0YGUv0yGRpAZJ1\nfDCujGdOJreC5AL3Qj/jvp80lBKnaAWb6WYU6SZS/IftwHuRiTWQW0aqZd/T8KRoi5X4c4ujZWSb\neMoNpc+NH6yKjLkoL7GpVAdbeI18at4Sw8LxST0ZH9sL3KRMFZlut2tlzM/PzuzcR+0aC2+xuX6W\neM4UPWio6W73p5EA+KjI8xbjC6HQMm2HLyhKzynik6IgUabHkM2KzGEbifscuHCjIr/tkO2Zvyn6\nBRCZXVrDfkMY0WmImaMV0244E2lLUmT4xbZlwFmHws8WvYfWVGaLic1rbuwNPzXiIFJnJ4+H4iJN\nl8sWBU64TAhGQ2juw3otWQtXHgnh/0G/Aardv9j1E5lDAAAAAElFTkSuQmCC\n", "prompt_number": 63, "text": [ " 2 \n", " \u239b \u2020\u239e 2 \n", "\u27e82\u2758\u22c5\u239da \u23a0 \u22c5a \u22c5\u27582\u27e9" ] } ], "prompt_number": 63 }, { "cell_type": "code", "collapsed": false, "input": [ "qapply(Dagger(ket) * Dagger(a) * a * ket).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$2$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAAkAAAAOBAMAAAAPuiubAAAALVBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAOrOgAAAADnRSTlMAIpm7MhCriUTv3c12VLge\nopIAAAAJcEhZcwAADsQAAA7EAZUrDhsAAABOSURBVAgdY2BUMnZgYAhjYH/BwJDKwDCTgWEWA0Oe\nA8O+ABAJBOsCgATHcxCTywBEKoMIngQQeYmBUYCBRYGBR4BBqrwoi4Fh37t3rxgAK1UOqPfNIGYA\nAAAASUVORK5CYII=\n", "prompt_number": 64, "text": [ "2" ] } ], "prompt_number": 64 }, { "cell_type": "code", "collapsed": false, "input": [ "qapply(bra * Dagger(a) * a * Dagger(bra)).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$2$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAAkAAAAOBAMAAAAPuiubAAAALVBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAOrOgAAAADnRSTlMAIpm7MhCriUTv3c12VLge\nopIAAAAJcEhZcwAADsQAAA7EAZUrDhsAAABOSURBVAgdY2BUMnZgYAhjYH/BwJDKwDCTgWEWA0Oe\nA8O+ABAJBOsCgATHcxCTywBEKoMIngQQeYmBUYCBRYGBR4BBqrwoi4Fh37t3rxgAK1UOqPfNIGYA\nAAAASUVORK5CYII=\n", "prompt_number": 65, "text": [ "2" ] } ], "prompt_number": 65 }, { "cell_type": "code", "collapsed": false, "input": [ "ket = BosonFockKet(4)\n", "bra = BosonFockBra(2)\n", "\n", "bra * a * a * ket, qapply(bra * a * a * ket).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$\\begin{pmatrix}{\\left\\langle 2\\right|} \\left({a}\\right)^{2} {\\left|4\\right\\rangle }, & 2 \\sqrt{3}\\end{pmatrix}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAKoAAAAdBAMAAADIl+p8AAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAMkS7zRCZdiKJ71Rm\nq90icBAQAAAACXBIWXMAAA7EAAAOxAGVKw4bAAADo0lEQVRIDZ1VTWhcVRT+ZiaZ/0wGKd2VDC6y\nEIxD40LQRaCkuCl5C0EUdYakiYtuJl0oiuCD6KJim2kKaaNRQhI3IhoQRAmScaNVECJtCaU/joha\nEEmMTohGnH7nnPdeJsxkWnJgzs93zvnefefedwdoL4mR0fYFB8pewtUD9bVvuoMet33FPtkH9sEV\nnsdkrl2+MRevi2yUBAvlGzPN/orTjLVGunKKPyy64x5dv2np/ag3rChRoX1R/LQoIOWqaVSJokSf\nG+SVWdCkT3nIL0C8Jv4RAxI5saGKaOArUV+LwpRqRHNmW+rOqge/BNhahhEf68/CWCe8bFcWCJfD\n1MZ6GKFVLxUYbbMouoQzM4/TnwSSS4JV8TwSmx7roFUBA8Ch5U8dhrrWnwG+3F7RNoNeQLyIlQqQ\nqaBHmlJlXAM+NNZY2W98BfikXpdIWGMLwGt+yrfaZsEsYjvorgLRPL4TKOLiY+DHrE4g6Qok8qwZ\namF9+xjwVIB4jrapz7GG51EY4OPncFIgnokhx2ft0yJRHTod8YS1TFY+fq9om0KxihiZQLiGfvFn\nRWHd0bVO041fH+cIbSclRda0S1aOqknWHTxIMKOJ49ShP3FCgqqo8D821yfoP+RGNkg0ILgIWZ8G\nWa1SIV+xLbbI4GX+Qu8XqeOb+JUmLD4yeWP9Hej8SEaOVFVwEbKWlXXY4gbNtjdfz/nPeydL1h1d\na5QgMMJXFmeeu1hDpsRHc70mU0hlldX7XHyclm0o5JEuK5b8QNcqE9BBx1Z3WZN5FLJ7WZ+Bsn6h\nvQ1K2hDdRsYhnYvIDtu2cYVg5wDVZwR1rZxAoYwVOAhXiatM4ctbt/5dAx7zEd9KG+Jb+JZAdw2R\n//QMvCpp1oaKiBkrd6uwhEd50+zZLWCBq8n7bJ7VNh51R746vmJmm5s8h0e4cvC9zs1M37a5vseD\nWkr/keCLFb1ePa/4iyNaQuffPihW24Ced4sM0hWslPTbSuYY8qwN1ev/G2sfR7J2/uxpkktOhWcA\nF+o39VDyfO6KtrFyUcHesaNMdZQQLdPaIfB2K+P6TW/5jq2VUS9/YTeAAye1Fbicn4PQHGP/X0Z3\nK130Ky76TsD6A5GWV/eTQSnwPf0bEg8aqKzBPuvRsIRMgKLIc+bvr39iSq+hb6zGWCe8hojrOXa7\nMEhzL1AJ0NaOfg+pIpPeDRfLSmG8Ihq4bEb0uLkR3ZNduKVni1pumTs4OHrw1vaddwEqO9G0u7w/\nYAAAAABJRU5ErkJggg==\n", "prompt_number": 66, "text": [ "\u239b 2 ___\u239e\n", "\u239d\u27e82\u2758\u22c5a \u22c5\u27584\u27e9, 2\u22c5\u2572\u2571 3 \u23a0" ] } ], "prompt_number": 66 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Coherent states" ] }, { "cell_type": "code", "collapsed": false, "input": [ "alpha, beta = symbols(\"alpha, beta\")" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 67 }, { "cell_type": "code", "collapsed": false, "input": [ "ket = BosonCoherentKet(alpha)\n", "\n", "ket" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${\\left|\\alpha\\right\\rangle }$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAABcAAAAWBAMAAADZWBo2AAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAVCKJRHYymd0Q77vN\nZqvYY74YAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAApUlEQVQYGWMQYoCCC0DaBMYpQebkIXM4JiAp\nYwVqguvhPIDEYdgE4ZiHOwB1C4M5Gg6ci5gEGDjAnMUMDNtZJzCwOwANYP/JwFDDzMDA9gDI4drA\nwGBlycDAaADkzDdgYLAXYGDgVgBy+IG22QNN0wYZwP6AgbeebQKDIYjDYHz3ArspA0MDmANUAgQs\nBUgcvgQkzhygLNzVV4GcMCAGg50wBpQGAPqnG1rZsH6bAAAAAElFTkSuQmCC\n", "prompt_number": 68, "text": [ "\u2758\u03b1\u27e9" ] } ], "prompt_number": 68 }, { "cell_type": "code", "collapsed": false, "input": [ "bra = BosonCoherentBra(beta)\n", "\n", "bra" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${\\left\\langle \\beta\\right|}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAABcAAAAWBAMAAADZWBo2AAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAZjKrmUTdVIm7Is12\nEO9EeINyAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAuUlEQVQYGU3OIQ7CQBAF0N9CaSltAjcoElQT\nzlBHCCEYHIYrECSyAgMStVyAVKGLwtaDQKM4Av9vSWCSzc7bmZ1dAF3U4RvATZmHPYNgCjS5cIsP\nFi3mToKFxYY4AWuLI1ECIyEsLLyXEHQBbzi+JILuR3E+sZgTAV2okqnCzrdwJWZ86SnciS3QSIW2\nATj9bASfx3u4K47hJ5fw+ru8qpFpskKVwT861eNXcUo+o1BbXNQ5ouSb1NsHbvYjC0BXYhoAAAAA\nSUVORK5CYII=\n", "prompt_number": 69, "text": [ "\u27e8\u03b2\u2758" ] } ], "prompt_number": 69 }, { "cell_type": "code", "collapsed": false, "input": [ "bra * ket" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$\\left\\langle \\beta \\right. {\\left|\\alpha\\right\\rangle }$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAADIAAAAWBAMAAABwLNKiAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAZjKrmUTdVIm7Is12\nEO9EeINyAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABMUlEQVQoFW2RL0/DUBTFz+ta1pUWum9QMgWq\ngc8wBYGFYHAzSJIpMjmBqBgwCGqqGCSZQpeEBFs/EibJFF9gCee+vnYp4TZ997z7e3/ObQGEqKKZ\nGqkkWzEHr52KdnsyMmwRevgIHqRQEb18gxUV4ZxpTXDJ2ZDvE3BVJ2+cTvlmwEGdzHn3TBNnWSet\nFG4IOHtHr1FJrt/FV3MEMeAHyXFJnnvB0hsAfZyRuIRyqHj7Bh79HOjyYZkH/hTEXgGHXIkOxN4p\nO1oUZGsC3N5QD0F7GAGNuCBf1HcD6iloDzPghUnu2Q5JqLyJ2MM9rAsBJHYMdWLlcLmvD2dnnOSG\nIGmH9hi6ma6YNlF9a93M7r9kn2s3889yy/ovBDQFlbEdE9VpKmNFY0P8yIhW4cjM/qRf9iQ7mZog\nmj4AAAAASUVORK5CYII=\n", "prompt_number": 70, "text": [ "\u27e8\u03b2\u2758\u03b1\u27e9" ] } ], "prompt_number": 70 }, { "cell_type": "code", "collapsed": false, "input": [ "(bra * ket).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$e^{\\alpha \\overline{\\beta} - \\frac{\\left\\lvert{\\alpha}\\right\\rvert^{2}}{2} - \\frac{\\left\\lvert{\\beta}\\right\\rvert^{2}}{2}}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAHYAAAAcBAMAAABG5lYeAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEIl2mSJE3e9UMqtm\nzbsXyEShAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAB4klEQVQ4EZVTvy8EQRh9e7d77nBuw3UiNlTX\ncL90ignRiGL9B5cQRKXSqolCQmhERCRKxD9wIrqTENGoTqGVqJRndnZnZmduNs5XzPe+931vZmd3\nH/BXXEz5hpH+iU8Dq1PtzJZO0XoI6wZWp56tb52idR7jroHWqZzpXOBEn5N1dEmaxiIY9BzAas2w\n9CZndURCgsC6jbVsII0V0DTqxmgUOkFwhoSAoLjscQ6BaBOLNFkLw5LVEUFulrgg2OlsyR7VVu4I\n1fZ1fiTLUG1JEARHqJapVgmqLeM2OF6PlNsnbkHwjquGQdvEp0n7iGxM+4IrdGszTadt0no4FI9C\ncNlarXRr06cPrqpNVYkF5/i1HdMySATBgE0/EQ3lvtu4SyHnoyRGSYiixGkbgwGMa+02ntaQAup8\nCF6IosRpOhJElBjOHmCDBI8zh7MvGi7YfyIW5AL2I/p9OM2kKPi4djEC7IV1tCaYVHV0voFpC6uw\nPUWbYFLV0c58yy5hpiZfFdsjwaTS0dZk3Q9PKyuHssJsUuHodd/xkrSW2aTc0c4uiudM298It4it\nqkl5Qzh6YL92z0k9J5hUOLpwoytk3W1S1hOOLnhy9r8oS7WGF9zTNulnFKNv1NO8MlSfbSp178Uv\nPMpycCRab9IAAAAASUVORK5CYII=\n", "prompt_number": 71, "text": [ " 2 2\n", " _ \u2502\u03b1\u2502 \u2502\u03b2\u2502 \n", " \u03b1\u22c5\u03b2 - \u2500\u2500\u2500\u2500 - \u2500\u2500\u2500\u2500\n", " 2 2 \n", "\u212f " ] } ], "prompt_number": 71 }, { "cell_type": "code", "collapsed": false, "input": [ "qapply((bra * qapply(a * ket))).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$\\alpha e^{\\alpha \\overline{\\beta}} e^{- \\frac{\\left\\lvert{\\alpha}\\right\\rvert^{2}}{2}} e^{- \\frac{\\left\\lvert{\\beta}\\right\\rvert^{2}}{2}}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAJkAAAAcBAMAAACADwDiAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAiZl2RCLdEO9Uu81m\nqzKufkATAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACL0lEQVRIDZWUPWgUQRzF335cNqfn5ZIUERsn\nSBqFZJMQAvGKxYCNIKeCH901YunEVkJIQMRuEWIhKY5AGiuLiJ0spL1CSBFLFUl9FppKztmvm+9F\n/8XNvvnNe3CzywP+Z75d6tiONycPbMi23/O7NnQON23Itv8+OLOh89iiNmbbr3dtBHhjRxIpLost\nz7V76yDor6AGBB8kj12QHBEEJ9ohAg/rcIFN4x8dpjOQXKO0Zw9aEmCC4DbmWVowt6Eiiyaotwll\nxqfDrnqEYPWYsLSx4W8V5dpbSmRA8BqLIUszDEGIk/Sf2mYGT2RE8AmnkS0twUFFWqODl2raR5ym\nV2QY4ie1XkWag3oo2wi+92+sWtK8vSNqTpueAsWjW2tyWBlDlO1MEi9dTPc2Fl0IW9iFE8s+ksti\nUVgj1aa0q2gcRmjBU3zFR6Z9a2lOvumkj8q8gr8D9sbdwvf2HRuK7Hse/RQeExtIeb/QPEMQYvyr\ntJ2Jqv4y194hnAH1CWb1MFT1l7n27raT2di7txgb0qr6S6y9qaWIuTeW5/KM7I0LepTM+2t0tmS8\n9u5HwYta7D/GHTGN69LB+0tnvPa2gX2PPoyD+dz3I1u4LtN4f2mM157Lmv6agy9HbVr60lXVYn9p\njNfeeA+4OIM/YhR7VrXYXxrjtbfVAi7H+KmkqVrEFWwiYWkAu73iZeY+VYtpFcz9jMZCk15nFyM6\nVP2vbLKfuNPwrvRFg6ZFqJ7l7C+9QpQ26gjm+QAAAABJRU5ErkJggg==\n", "prompt_number": 72, "text": [ " 2 2 \n", " -\u2502\u03b1\u2502 -\u2502\u03b2\u2502 \n", " _ \u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\n", " \u03b1\u22c5\u03b2 2 2 \n", "\u03b1\u22c5\u212f \u22c5\u212f \u22c5\u212f " ] } ], "prompt_number": 72 }, { "cell_type": "code", "collapsed": false, "input": [ "qapply(Dagger(ket) * Dagger(a) * a * ket, dagger=True)" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$\\alpha \\alpha^{\\dagger}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAACIAAAATBAMAAAAHT8L5AAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAiZl2RCLdEO9Uu81m\nqzKufkATAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAsklEQVQYGWNgQAVXULlAHqaIOLqa1Ys60YQK\nxAvQRBjuoQswrCRC5CaGGrB7hIwcgBKMyiogaT0gDnNgb2WdwJrCUBEQycAgChRpZGBYxFzAIcDA\npWDOwABETN8ZGLQZGfQLGJg2CDAwAB3IsYCBQUKcoQtoUiPEvfVACfkJ7B+BIj+BZgAB/wGgCAPD\nH6DIB7AAA9MFBh59vgJdBoZDH55DhATPHGASZmCUOcOgaAASAQBNXiGRv1lbYQAAAABJRU5ErkJg\ngg==\n", "prompt_number": 73, "text": [ " \u2020\n", "\u03b1\u22c5\u03b1 " ] } ], "prompt_number": 73 }, { "cell_type": "code", "collapsed": false, "input": [ "normal_ordered_form(a * Dagger(a))" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$1 + {{a}^\\dagger} {a}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAEEAAAAVBAMAAADrxp6XAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAzRAiu5mrdu/dZlSJ\nRDLkM64aAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAA3UlEQVQoFWNgwAFycYgjhAmrOIRQjJ3l6NqN\nXQIuqnBIAc5mEEIwkVh5CLbJJwQbieUNZ6uEwVQwGcAFgQyECgZ2mAruAmQV2QgODhVI4YGhgjmn\nbhIDQxzQDAgL05YbBiwfGBgOA1VAWBgqmLoYWB0YGIoYGKAsDBWsnxg4gW5WYGCAsqAqeAQFJRsF\nBQMYGDgcGPQfAK1AsNBdqn+AYT/IBAYGGAtDxQYGR24DsAooC10FYwHXNB6QAgYoizXjZxaYzwAN\nU6b0c2a1YBEEC6IApgLKw0bxLsAmygAAFlQ3VdFpO00AAAAASUVORK5CYII=\n", "prompt_number": 74, "text": [ " \u2020 \n", "1 + a \u22c5a" ] } ], "prompt_number": 74 }, { "cell_type": "code", "collapsed": false, "input": [ "qapply(bra * a * Dagger(a) * ket, dagger=True)" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${\\left\\langle \\beta\\right|} {a} {{a}^\\dagger} {\\left|\\alpha\\right\\rangle }$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAFEAAAAZBAMAAAC7qt8EAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAZjKrmUTdVIm7Is12\nEO9EeINyAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAB3klEQVQ4EY2SvUscURTFz+p+70wcLSSEIAuC\nkFRLRExhIYKFWLhI6riYNsKWYuMgLhHxYwtBiISsKIKdf4DFRBIQFmEgTYKQJWmSbCVptAnknLc7\nE11R9jJv7rtnfnPemzsPuCuG7npwS2+fXL/1LpymlKhcf7az9RNYCBTDdORU7j5CMh/oyv66D5QC\nZVyTqACr+DV7k8QzyiHZLzKuWw9i5RZym3JIxrkA5jnSDhKF+0jLIfWWwwI6cy3kMPXQ0z6iHYfI\nl5UWUv0MSfkl5Tu9X52FyL21AR/p5ydzwFiTXP5IXXs0H+R9Wf4hMlbHe9mnLoDVBnmQt+vporAX\nFOACVZHfHEzA/o5oGThrkL+ALctXL8dFesCMyCkfrxH9izgFH9onC0wmAf6fDxRiWaBP5G/Yf/Cg\njBoFRUkFNngEEi7OKfAdDJK0r5C4sGsuFo2jSBbYLAKpii5k2Ky6yEukjhZqRew0T0sJXQ5JGh0a\nW6QcDORJ4hi9OTfjRV5pFQb3mUNkqsPHG1YFtvPhKbdC8vPp05G8PbK090mcSKx0O9E1Q+njXSOT\nbA2SjYiNMj9ph+zMksz4tsdkVjf52i30VIcQ8dROxn2rPxagA2XCyjYn/9NJMH0XTNrJ/wAKrG/I\nWjjaIAAAAABJRU5ErkJggg==\n", "prompt_number": 75, "text": [ " \u2020 \n", "\u27e8\u03b2\u2758\u22c5a\u22c5a \u22c5\u2758\u03b1\u27e9" ] } ], "prompt_number": 75 }, { "cell_type": "code", "collapsed": false, "input": [ "qapply(bra * normal_ordered_form(a * Dagger(a)) * ket, dagger=True)" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$\\alpha e^{- \\frac{\\left\\lvert{\\alpha}\\right\\rvert^{2}}{2}} e^{- \\frac{\\left\\lvert{\\beta}\\right\\rvert^{2}}{2}} \\beta^{\\dagger} \\operatorname{transpose}{\\left (e^{\\alpha \\overline{\\beta}} \\right )} + e^{\\alpha \\overline{\\beta}} e^{- \\frac{\\left\\lvert{\\alpha}\\right\\rvert^{2}}{2}} e^{- \\frac{\\left\\lvert{\\beta}\\right\\rvert^{2}}{2}}$$" ], "metadata": {}, "output_type": "pyout", "png": "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\n", "prompt_number": 76, "text": [ " 2 2 2 2 \n", " -\u2502\u03b1\u2502 -\u2502\u03b2\u2502 -\u2502\u03b1\u2502 -\u2502\u03b2\u2502 \n", " \u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500 \u239b _\u239e _ \u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\n", " 2 2 \u2020 \u239c \u03b1\u22c5\u03b2\u239f \u03b1\u22c5\u03b2 2 2 \n", "\u03b1\u22c5\u212f \u22c5\u212f \u22c5\u03b2 \u22c5transpose\u239d\u212f \u23a0 + \u212f \u22c5\u212f \u22c5\u212f " ] } ], "prompt_number": 76 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Fermion Fock states" ] }, { "cell_type": "code", "collapsed": false, "input": [ "ket = FermionFockKet(1)\n", "\n", "ket" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${\\left|1\\right\\rangle }$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAABMAAAAWBAMAAADQs7pMAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAVCKJRHYyzRC7mavv\n3WYouEVCAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAd0lEQVQIHWMQYgCDB0DSBMJcAmVWMDBkQ5ia\nPxgYeBtACjpXA5msD8BqWYFMjgI4k2ESgimMYPIimFwOICtA2hjYNsCZjAZwJqcCnKmJ0GYIYnLt\n+buPgeECWBSon4FlAZzJnQBntgNloL54CmSGATEQzIBQUBIAx4Yejz3P57MAAAAASUVORK5CYII=\n", "prompt_number": 77, "text": [ "\u27581\u27e9" ] } ], "prompt_number": 77 }, { "cell_type": "code", "collapsed": false, "input": [ "bra = FermionFockBra(0)\n", "\n", "bra" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${\\left\\langle 0\\right|}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAWBAMAAAAyb6E1AAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAZjKrmUTdVIm7Is12\nEO9EeINyAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAqElEQVQIHUXOOwrCQBCA4T8hMYkPkiPY2gVP\nEAR7Cw9g5xXEKo2dRWqr3MDtbNXawkJEEExuoYWCs7uQTLHzMcxjgQQTa3BTyw14M27bCQg7cOBe\naq5wakKluSNKCX7CriJO8d/CMKHK8L9CmdrnuB/hvOUUqtw2nCDOCPTYU44UOHpZVNKv8fSJIIcl\nr6GQBTwuY/MdWWFCqqOWvWtTdY4NB8rybJN5/6RlLJx2z3ytAAAAAElFTkSuQmCC\n", "prompt_number": 78, "text": [ "\u27e80\u2758" ] } ], "prompt_number": 78 }, { "cell_type": "code", "collapsed": false, "input": [ "(bra * ket).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$0$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAOBAMAAADkjZCYAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEJmJdjLNVN0iZu+7\nq0QgoRR7AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAVklEQVQIHWNgEDJRZWBgSGeQmMDAtYGBOYGB\n5wID+0cG/gsMfN8Z5BUY+L4wzDdgYP0MJeUNQCL8Cgzs3xk4DjBwfWRg2cDAlMDA0M4gHcDAIOxy\nlQEA9FISlFfRJtkAAAAASUVORK5CYII=\n", "prompt_number": 79, "text": [ "0" ] } ], "prompt_number": 79 }, { "cell_type": "code", "collapsed": false, "input": [ "c * ket" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${c} {\\left|1\\right\\rangle }$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAB8AAAAWBAMAAADKj1rCAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAiXYyIt1Uze+rmRC7\nZkTTotXTAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAtUlEQVQYGWNgAAE2BzDFcAFCMTAwPoCw1qEI\nVDMwWCIL+PxmYGDdABUBatmzEijABDMEZAYTUIC7AKECLMBwBCQgqGQAU8GQCOS7JrAXwAVYgQKN\nDJwJcAGuBwxcQLPADgMZysA8gYHjALIAmwDDfgFkAR4HBn6gWxBm+DAwcE1g2IWwVgyoXPCuAshQ\nrhlf5zIwBAAFQABkLQjwLQBTCAFOAzSB7VA+XMslmAATVOlpmAASDQAX7DTp3RaMeQAAAABJRU5E\nrkJggg==\n", "prompt_number": 80, "text": [ "c\u22c5\u27581\u27e9" ] } ], "prompt_number": 80 }, { "cell_type": "code", "collapsed": false, "input": [ "qapply(c * ket)" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${\\left|0\\right\\rangle }$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAABMAAAAWBAMAAADQs7pMAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAVCKJRHYyEJnN3Wbv\nu6uKc90MAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAqElEQVQIHWMQYgCDDUDSBMJsATPZmyMSGPLA\nTE4B9kUMXAUgBXsYGCwZWIGKTRjuMTDIF7BPADH/MTD4CzBcAjLZfwCZAQzCQCbTZwaGfAMGLgST\nwwGoACgKVMD2AKgNqFZegIHRAMhcy8Cwv4CBVwHIjGFg6GRg0AVqY+ASYD/GwGAIYrKbxiUwMCwA\nMcGApQHO5EuAMyuBclAFW4HMMCAGgusQCkoCAOVMIAjdmSrdAAAAAElFTkSuQmCC\n", "prompt_number": 81, "text": [ "\u27580\u27e9" ] } ], "prompt_number": 81 }, { "cell_type": "code", "collapsed": false, "input": [ "qapply(c * c * ket)" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$0$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAOBAMAAADkjZCYAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEJmJdjLNVN0iZu+7\nq0QgoRR7AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAVklEQVQIHWNgEDJRZWBgSGeQmMDAtYGBOYGB\n5wID+0cG/gsMfN8Z5BUY+L4wzDdgYP0MJeUNQCL8Cgzs3xk4DjBwfWRg2cDAlMDA0M4gHcDAIOxy\nlQEA9FISlFfRJtkAAAAASUVORK5CYII=\n", "prompt_number": 82, "text": [ "0" ] } ], "prompt_number": 82 }, { "cell_type": "code", "collapsed": false, "input": [ "qapply(Dagger(c) * ket)" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$0$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAOBAMAAADkjZCYAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEJmJdjLNVN0iZu+7\nq0QgoRR7AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAVklEQVQIHWNgEDJRZWBgSGeQmMDAtYGBOYGB\n5wID+0cG/gsMfN8Z5BUY+L4wzDdgYP0MJeUNQCL8Cgzs3xk4DjBwfWRg2cDAlMDA0M4gHcDAIOxy\nlQEA9FISlFfRJtkAAAAASUVORK5CYII=\n", "prompt_number": 83, "text": [ "0" ] } ], "prompt_number": 83 }, { "cell_type": "code", "collapsed": false, "input": [ "qapply(Dagger(c) * c * ket)" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${\\left|1\\right\\rangle }$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAABMAAAAWBAMAAADQs7pMAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAVCKJRHYyzRC7mavv\n3WYouEVCAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAd0lEQVQIHWMQYgCDB0DSBMJcAmVWMDBkQ5ia\nPxgYeBtACjpXA5msD8BqWYFMjgI4k2ESgimMYPIimFwOICtA2hjYNsCZjAZwJqcCnKmJ0GYIYnLt\n+buPgeECWBSon4FlAZzJnQBntgNloL54CmSGATEQzIBQUBIAx4Yejz3P57MAAAAASUVORK5CYII=\n", "prompt_number": 84, "text": [ "\u27581\u27e9" ] } ], "prompt_number": 84 }, { "cell_type": "code", "collapsed": false, "input": [ "Dagger(c) * c" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{c}^\\dagger} {c}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAABsAAAATBAMAAACTqWsLAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAiXYyIt1Uze+rmRC7\nZkTTotXTAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAfUlEQVQYGWNgAIN5EApGonGlYeJg+vipNmT+\nBukNyFyGySg8hmN4udNQZZHsFVQyYFgMkgUxGFwT2AsYRIA8MIOhkYEzgUEbyAUzuH6D1AFdAWFw\nHABxgQDC2C8A4TFAGPwXGBgSQCIQBtcEhl1A84F6IQzBuwogHtBaIAMAohMbe/npeTMAAAAASUVO\nRK5CYII=\n", "prompt_number": 85, "text": [ " \u2020 \n", "c \u22c5c" ] } ], "prompt_number": 85 }, { "cell_type": "code", "collapsed": false, "input": [ "qapply(Dagger(ket) * Dagger(c) * c * ket).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$1$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAPBAMAAAArJJMAAAAAJFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAADHJj5lAAAAC3RSTlMAzRAiu5mrdu/dZmiL4QAAAAAJcEhZcwAA\nDsQAAA7EAZUrDhsAAAAjSURBVAgdY2BgEGJgYDDZxMCgEgYkGNhJJVgzdmYB9TEwAACPpQrvlUCH\ncAAAAABJRU5ErkJggg==\n", "prompt_number": 86, "text": [ "1" ] } ], "prompt_number": 86 }, { "cell_type": "code", "collapsed": false, "input": [ "qapply(bra * Dagger(c) * c * Dagger(bra)).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$0$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAOBAMAAADkjZCYAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEJmJdjLNVN0iZu+7\nq0QgoRR7AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAVklEQVQIHWNgEDJRZWBgSGeQmMDAtYGBOYGB\n5wID+0cG/gsMfN8Z5BUY+L4wzDdgYP0MJeUNQCL8Cgzs3xk4DjBwfWRg2cDAlMDA0M4gHcDAIOxy\nlQEA9FISlFfRJtkAAAAASUVORK5CYII=\n", "prompt_number": 87, "text": [ "0" ] } ], "prompt_number": 87 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "TensorProduct spaces" ] }, { "cell_type": "code", "collapsed": false, "input": [ "I2 = TensorProduct(IdentityOperator(), IdentityOperator())\n", "\n", "I2" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{\\mathcal{I}}}\\otimes {{\\mathcal{I}}}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAADUAAAARBAMAAACP9fljAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAZrvd780yIhBEmVSr\ndokAK0XoAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAA7ElEQVQYGV3Pr04DQRDH8a+AdLttEAiQKDwC\nVYnrE4AEQlJXzh1BXZBNGrBUbTBHqu4R0DwCBhQJIdQVHMvsn4EeK2ZnPr/s7h2wue/9ktZSOt0a\n7YyqVqRkhjBoJfxS55jeV8rM0+IjXLBC9PdSNqsw76lVYs1F6B7KdtXEPhOcp7lvC4y7j1kmeK7i\nvE3NhGnsM8FuHHHYC8dGHDLBd8peYE7OMtH91HNmXmDDoITNv+DktTplSlw3yBfCbUdeK07COaXy\nriwfA9hLKa8PUpTOvPcHNwKYIynrcsMfBU5r0tCrdfi/jxdvq/QD4c9F+IJPnbcAAAAASUVORK5C\nYII=\n", "prompt_number": 88, "text": [ "I\u2a02 I" ] } ], "prompt_number": 88 }, { "cell_type": "code", "collapsed": false, "input": [ "psi = TensorProduct(BosonFockKet(1),BosonFockKet(2))\n", "\n", "psi" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{\\left|1\\right\\rangle }}\\otimes {{\\left|2\\right\\rangle }}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWBAMAAABkuUxDAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAVCKJRHYyzRC7mavv\n3WYouEVCAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABgElEQVQoFXWRMUsDQRCFX+5yZnMhIWhntaUK\ngpJoYWVhlcrKwkIPLAURKzuvETE2YqU2HsFCY5NKbCR/QNFSsDAI/gJtJb7JZm9NxCnezM58tzM7\nh1H0rGSc04w2cYeuasJw0fhU/X7ikhlhcjFGWmnVBGS85lmETcN4FzHw8pc5gv+FImtVqPM2/Zph\n1GpljieA99wBDwg6ptc6swdSAGox1KwEZB6BdqS2HZPXUsnuUA7LFDJ7MRmcOCYzI0wh1FDJlWGo\nbzHGHINnYd7RQB37lsl+AsVfjCwCCcKJBL5liscANyf7kZl7iwAbNjmLZa4ZcHMpw75yj2pqhH0m\naDHgoCnD+YWpcyLLjMPT4IMt47E1sORxGr3FiG8fSRBoTLqZ/bIw4RRlXlqQma4s3APcKO+5eXrt\nyBNpapeS0xTZYbf7DdmJ9BKrGVcvI9OQkEzPsoljbk0KGxXzlWUKUcrIrxswy8i/7vcqLQ8QrtcH\n8yumlo+HmCAyidOh/D/HH3EAUUloLL0NAAAAAElFTkSuQmCC\n", "prompt_number": 89, "text": [ "\u27581\u27e9\u2a02 \u27582\u27e9" ] } ], "prompt_number": 89 }, { "cell_type": "code", "collapsed": false, "input": [ "I2 * psi" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{\\mathcal{I}}}\\otimes {{\\mathcal{I}}} {{\\left|1\\right\\rangle }}\\otimes {{\\left|2\\right\\rangle }}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAHwAAAAWBAMAAADwX+WxAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAZrvd780yIhBEmVSr\ndokAK0XoAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAB90lEQVQ4EYWSP0gbURzHvzF/7rwEKR3qaBYV\nXAziUEqR0q1T3XTUIggimi3idAguATFrs/Rw8Q8O2bqVmzp0aV0URDCTEIpxMjp5/n6/997l3knw\nDe/P5/P9cveSAwaPn0plXiQs8XY2iu7tiEIdBb2GLYGk+PZudWzVtxIacSrvoxDSag0S2wcTKISA\n+wX4YMkYUcqZ9oH3tuanuyHuGiycJRQflHcvu7eUjhGlpv4SOLM110s+cp+0KFWUb/pw/6utIHo6\nrn1gN607yFVQ6mmRC8QPL9Cy05K9IFMfqjJL6A7yj1xXYlNVSl4VbnAkdUGmXmwzS2gWyD5CCX5B\nGqM4RB17shdk6pDLJbTUf7ShxLg0EMDbCjAiB0Fx/ZhZQkt9hpiIJ2mgDZxA1wXF9XUOJDQLr0wT\ni+EeTTQCuCdVeLxVKK7/SmkWV8xYeHI1rtfp9lJXKK5PcjShSRQD1AAW+y3Qbw58d+jm1WWOKmTq\nTplZQpNYAy7AonZQq/1h723TdBPSpJGpj8gf29f01Tlz3dMKSKxEUfS5QR24izTl6T0Movrp149v\nkGXb1/zR5qlV0UIsTfUWiofmQCs/nUdTLX2dEkoDG10jhJjDb+1jnRamb6865c7bOH6tl8IK6nrm\nn0XpMFBYwXN1GvItSoeBIh187fwMyOO//AkPUOQAAAAASUVORK5CYII=\n", "prompt_number": 90, "text": [ "I\u2a02 I\u22c5\u27581\u27e9\u2a02 \u27582\u27e9" ] } ], "prompt_number": 90 }, { "cell_type": "code", "collapsed": false, "input": [ "qapply(I2 * psi)" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{\\left|1\\right\\rangle }}\\otimes {{\\left|2\\right\\rangle }}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWBAMAAABkuUxDAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAVCKJRHYyzRC7mavv\n3WYouEVCAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABgElEQVQoFXWRMUsDQRCFX+5yZnMhIWhntaUK\ngpJoYWVhlcrKwkIPLAURKzuvETE2YqU2HsFCY5NKbCR/QNFSsDAI/gJtJb7JZm9NxCnezM58tzM7\nh1H0rGSc04w2cYeuasJw0fhU/X7ikhlhcjFGWmnVBGS85lmETcN4FzHw8pc5gv+FImtVqPM2/Zph\n1GpljieA99wBDwg6ptc6swdSAGox1KwEZB6BdqS2HZPXUsnuUA7LFDJ7MRmcOCYzI0wh1FDJlWGo\nbzHGHINnYd7RQB37lsl+AsVfjCwCCcKJBL5liscANyf7kZl7iwAbNjmLZa4ZcHMpw75yj2pqhH0m\naDHgoCnD+YWpcyLLjMPT4IMt47E1sORxGr3FiG8fSRBoTLqZ/bIw4RRlXlqQma4s3APcKO+5eXrt\nyBNpapeS0xTZYbf7DdmJ9BKrGVcvI9OQkEzPsoljbk0KGxXzlWUKUcrIrxswy8i/7vcqLQ8QrtcH\n8yumlo+HmCAyidOh/D/HH3EAUUloLL0NAAAAAElFTkSuQmCC\n", "prompt_number": 91, "text": [ "\u27581\u27e9\u2a02 \u27582\u27e9" ] } ], "prompt_number": 91 }, { "cell_type": "code", "collapsed": false, "input": [ "a1 = TensorProduct(BosonOp(\"a\"), IdentityOperator())\n", "a2 = TensorProduct(IdentityOperator(), BosonOp(\"a\"))\n", "\n", "a1, a2" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$\\begin{pmatrix}{{a}}\\otimes {{\\mathcal{I}}}, & {{\\mathcal{I}}}\\otimes {{a}}\\end{pmatrix}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAIoAAAAaBAMAAACaz9kUAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAMkS7zRCZdiKJ71Rm\nq90icBAQAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACh0lEQVQ4EaVUTWgTURD+Nu3bbpM0Vr1UURpE\nRARp0B4ERXIRvAgBS4pe8kCtEUGiYA9eXJGWHCymXjR4CQqeBHPy4qERLyKIBUERQepBD4JgxUC1\nh/Wb/WnfhuaSzmFmvpn5ZufN7lsA27A5qQjdym2uCQ4Kv7+wUZdXPzzvTzyRPv7M8/LxmKDBFtVF\n8Tpl+8uRdyPx9taxrXeWZzoLBX8DnPYGCfUI+N4RP5tFRnfEAjjNeczM5KX6dck4w0itBCVr+haw\n4PpITdfvm3PeBZLNtTokLgBnQjy0tB6PvC+Bs68A9TCK0WZaGDW67nUBdTTIJ3VgTf3EB4mTNKeN\nh9s5vGHI+XSVGwIWy0DRDtqOGmWSo1irvhmyXSjNsSPiQAPnCQ64fb9o0q7tKq0qksfNoJnvh2og\neBGvUUYRkxIMiIk2DvMQT8GhABsoF4GaTxr3dUz15X2oYc9oDNIPidYyTpHdRkYGYMLWUZe/PiOm\ntgT9qaf84ojo/JbPIplDaZj1nKXIzbARkFgWHZcxKZK8mnKlOCI6qzJLqYYFFKSL0tycllJ7SXRc\nrgRQcytlv0tI5CzSpYnxlMvnZ2eBB1ZLihljw5goviKOij0Ot+LuohcSrRW8532spH/KslDWPO9u\n8arnqtUPKOXFD8WZPVKd0wQ2n4X5RaqQyHd0g6v+OD93jUFM8FiQb2qn53mPeW+MO2bxQv87JFXq\nBFW/SxUS0w2MCTMUdRl47kaIdr/hr7vFJlJytEj4mSSzEaC16nUTomXkDHdH/Z6BeDDYNTMQ91Ur\njrugUgFWo0uO4XT3lJl5S/DZDPTkfyVroiemQUrLTlLaiPTi3vZJL3qhGhz/T2Pgnt3/Am2QogPQ\ngg0AAAAASUVORK5CYII=\n", "prompt_number": 93, "text": [ "(a\u2a02 I, I\u2a02 a)" ] } ], "prompt_number": 93 }, { "cell_type": "code", "collapsed": false, "input": [ "a1 * psi" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{a}}\\otimes {{\\mathcal{I}}} {{\\left|1\\right\\rangle }}\\otimes {{\\left|2\\right\\rangle }}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAHkAAAAWBAMAAAAWdi71AAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAIquJdjLdEETvu2aZ\nVM0GsGrEAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACFUlEQVQ4EYWSP2gUQRjF3+X+7CaZkzkLi2Bx\noCiiYOSwU7hGtHNjp42HjQiCi1rJkdvWxlL805yVIBhSaGPjRgslKARsBWNlGUVMrFzfN7O7M64u\nDuzt973fe/PNHAvUra62ZLVqqAW58cWVLPvVTGz3tpquBdZ44fnSy6XYmL4A5/6Rbrx7Ev0NjDG4\nB1wFJL2wA3TiSpzgOpo/K+Dm68FpMTYidL+Z9K1XTLfyixdYtj0I3C+B2Tx8A9zYsHNmRnZ2i+lg\nE7IcZvoucDQKNkXP1x1N51PbzKYujUdGc5jprZhpAxr7Tl0W3l8Dxio21os8A02Q2fhgJIcFANdi\nA27rua/s5rXSQRoMheAsNynTHVE8bNLhd/6fPOxDqCmxAtbGwKJYscKnTKuEnYdNujOllkDtoDMk\nbrJLizQ3dul2/09s0uvUCGanmEQsufmYN09ZIvzBn3J2V87jYQP61Agmi/gEXlMhSJW2aTUiK9Nz\nmp2HBXxEQ4NgsoEV+e7DZC9wrL1Kp2hKl+kFkTxM0E7R0iDYNZy/xDvzP0s5z3zUvfVe74ibfVKo\nh5neMzhxACAI9h/ffUbwMo+Pz3zOZ1n2IJG0OrR9GBhR87CArSzbLoChCN7zOnLFfNFkVpial8MV\nYF1oDwZJXsqrMM1EVixxFXgZVxamZSfZqhb4xsL0zBelrgW+sZWf+LEvSl0Lqsb/9b8BNBKXV0rQ\n0m4AAAAASUVORK5CYII=\n", "prompt_number": 94, "text": [ "a\u2a02 I\u22c5\u27581\u27e9\u2a02 \u27582\u27e9" ] } ], "prompt_number": 94 }, { "cell_type": "code", "collapsed": false, "input": [ "psi1 = qapply(a1 * psi)\n", "\n", "psi1" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{\\left|0\\right\\rangle }}\\otimes {{\\left|2\\right\\rangle }}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWBAMAAABkuUxDAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAVCKJRHYyEJnN3Wbv\nu6uKc90MAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABpklEQVQoFXWSP0jDUBDGvzRNE1taiy6Ob1ME\nsdIqjg4OHV0UwSXgKEhAhCr+CUW0i1BdHKuToyK4dxYHcXESMim4SFEpuNTv8tLWVrzh3pe7X+7u\nXYIhhJbSR9cbSutrHgUtnTl9drwZBQ4YIVOaPkQi6GS1IBOrPLtY18wJthUu/zJ7MD+R9KROqg6z\nihXN2Mv5aUYB1nkF7mFxoALSAYwmtjRT9GBPRcwd8O7aVWEGA8QbSCvJxE/pdrN0rFPzyOBRmH0f\n8S8YOWEyjoLtH2mG/srDsDCTOSQ+gHOGcIMyStikYh2WZTz5i5FFwIcz6sOkCpnkA8DNsVdOeoWL\nABtWmG8zxxSJQGb2YTQgfaWOXVFwIsYKKDhoASyYakLmF6bEidrMCGJKLlyAVYdTRYytgfkYp1Fr\nVJwn4cNSmJCZcYEdF2ZWGGeMbiagIzOen30DuFEyG4sv4RWZsc/oBpRmaq3Wd7iT6N9AkXFaKQuj\nLCK8O8+4H9ahAlgqtNW8fqvNZNwOI5+ux9qMfOuoV2qhh+j2umV8SefSXh9juTrw1Bf/5/EHXr1W\nuaXhGx0AAAAASUVORK5CYII=\n", "prompt_number": 95, "text": [ "\u27580\u27e9\u2a02 \u27582\u27e9" ] } ], "prompt_number": 95 }, { "cell_type": "code", "collapsed": false, "input": [ "psi2 = qapply(a2 * psi)\n", "\n", "psi2" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$\\sqrt{2} {{\\left|1\\right\\rangle }}\\otimes {{\\left|1\\right\\rangle }}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAGIAAAAaBAMAAAC++pSRAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAInarRM2ZVBDdiWbv\nuzJCz3LGAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAB5UlEQVQ4EY2Tv0scQRzF397ldsc7DWuhWJoE\n0gT0/gK9QmzVLuUeiqYJXNpUS0AhhXhgI4JwhAPhhERbKxtrtUmpgmChRWIjVur3za/bu1O4L+zO\nm/e+H2ZmhwVMBU+s/3bWz5Cv9NOV7RnJTvrSK311ZZpU3UyiWI+lTGTkNzO0g7BmnGJFj6EZjKff\nTaPbwU9g9Os5QKKQ4m050+yJjmAPqow/FRLBRQpsvUB0BHKMfIrBIyHU32khPhlCfWz9kplUEx0B\ncvsYFOhR72pSelZ1G2ZTqF0teQ4XzIgekN0/ZIkh/c3eLEi2rj+KIyTIHYv7Xh7hHvwaUYNGPoyh\nki+UjpBgbLIC1GliruEJ4xygijX8YOYIBhunKDVoYsd8XW4XSzQShGMJipSekCC8w0BKMzzNEFd0\nGsCyeJSekCC4xyE9fJCHN6jX+E4ngVqOEVJ6gsF0qu8rSjDcJs7Ylsgpql0Eg3+7CeNr4J0nAtkh\nMBPIKeJbSreGDgrHqVjBdmux7olijW3hqLx+lykdoYPonlZBflpNLJ5s7vNKpdRnBjGlEJmAN2uL\nJ2fNmmGthqiqJddg2cBM+HbElLVuWrbVES7wiCXUvHessERvYInS+CtEb5C71K1DaTcxYYzeoLvx\nhfkzpm96qKJl7qQAAAAASUVORK5CYII=\n", "prompt_number": 96, "text": [ " ___ \n", "\u2572\u2571 2 \u22c5\u27581\u27e9\u2a02 \u27581\u27e9" ] } ], "prompt_number": 96 }, { "cell_type": "code", "collapsed": false, "input": [ "qapply(Dagger(psi1) * psi2).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$0$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAOBAMAAADkjZCYAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEJmJdjLNVN0iZu+7\nq0QgoRR7AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAVklEQVQIHWNgEDJRZWBgSGeQmMDAtYGBOYGB\n5wID+0cG/gsMfN8Z5BUY+L4wzDdgYP0MJeUNQCL8Cgzs3xk4DjBwfWRg2cDAlMDA0M4gHcDAIOxy\nlQEA9FISlFfRJtkAAAAASUVORK5CYII=\n", "prompt_number": 97, "text": [ "0" ] } ], "prompt_number": 97 }, { "cell_type": "code", "collapsed": false, "input": [ "qapply(Dagger(psi2) * psi2).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$2 \\cdot {1}\\otimes {1}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAEUAAAAQBAMAAACy4K9eAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAIpm7MhCriUTv3c12\nVGZoascqAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAA/klEQVQoFWNgVDJ2YIAD7gA4E8oAiYQxsP+A\nizPao6sBi6QyMMyEqWE1yoeoYT1UXgNmQURmMTDkO8AUMZyHqGkKYGCthQiCRPYHYKrh2AiUD74A\nVgTVtR6iGSQEEWFjEmBgVVBFUsPxHcxBEnnIoMgQxBCDJMJlAOJAzIKYo8DAJKrAwI6kRhnEZv2N\nJFLAwKDEgKyGJwEsuwxJjQIDq5IAAxNC5BIDowCYByJgdgUBXYRQw6LAwIOupoMR6BoBP7BOkC6p\n8qIsMAcuwsDAJATklCTARfb///8LzAERavOXPQBSrFuBBDfYdKgIkI8Ogi4w8CqiC6Lz3csrEEIA\nRXM+O2NZdEEAAAAASUVORK5CYII=\n", "prompt_number": 98, "text": [ "2\u22c51\u2a02 1" ] } ], "prompt_number": 98 }, { "cell_type": "code", "collapsed": false, "input": [ "e = TensorProduct(IdentityOperator(), BosonFockKet(1))\n", "\n", "e" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${{\\mathcal{I}}}\\otimes {{\\left|1\\right\\rangle }}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAD0AAAAWBAMAAACBJ4kvAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAZrvd780yIhBEmVSr\ndokAK0XoAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABTElEQVQoFW2QvUvDUBTFD1bty2sq4qCTOImO\nGZwc3dzc7FhF6CIaukScQsElILrq9HCpFodsbtKCk3+Ag4udhCJ2ET8m473v5aU+6B3uuef8kptL\ngHF1Z8JZLXNrWfbpPjUw9oZld76x1IhNYDvzGrBPIjaBdZtbJd78AUoxUK6j8m1y8Tx8p4RqgNYt\n8ao5wA90iMsY4i3nqBIXW9pNKi3eNkkr5Zn2M8cKGxzqDL4MIdQ1J5bfs8FLrGUBbSQ45dnykgbL\nukNBHinM/OfynN2v4X2gA5dPdwl5X9SoFEQnhOTR7q/0yciAI+YJXeDwiZDysxR0OXBRpq+HO/yo\nfb9Jc3QVRY8cymNqr11qBae/tZdl2YY+U9SITPEm4vLhowcEbIpKUlTa2tF+Lk9pKdrBMAe5+PUC\nuUPOT9x05HK+OErc6cnYVTcd5/4AEJ5dESW0s2YAAAAASUVORK5CYII=\n", "prompt_number": 99, "text": [ "I\u2a02 \u27581\u27e9" ] } ], "prompt_number": 99 }, { "cell_type": "code", "collapsed": false, "input": [ "qapply(Dagger(psi2) * e).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$\\sqrt{2} {{\\left\\langle 1\\right|}}\\otimes {1}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAFUAAAAaBAMAAAA01Q3QAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAInarRM2ZVBDdiWbv\nuzJCz3LGAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABvElEQVQ4EZWTP0jDQBTGv7Q2iVYlDoqLgwqu\ndVcwQ3FVt46RiroIzk6HYMFBFFxEEIoIQgtaHZ1cOlsXRxUEBx3URXRRv3fXxJSAfx7cvfe979f2\n5XIFTFifEs9N9XNK+z/7cbc3Ln6pF37xY7a7FYqsKRwvbCSyvRy27kzR4YeNRF4H+paupT3HVQAS\nbEaJK1GFO4pjnxWHGXhLstaNoinBcdMKneeAU8ZGMWLdkcq+0sDVhM6sUzV0Ev8AuvhMqYidVHAP\nhQVyilueqx3IvGlWzjli22aoNsxjC5uqUw9x8RP8vipzxKZtD26wqE1h+3O+fiA2psqmitgTzKKE\nVVrNGTYbyBJi7AFtAXPEBrD7A3SIZ+a1X9CuRNkNLp9FxJaBeR4fW03WesWZVsPceSAxNoA778HW\nrj4HTKgdUU6AHrjTrWyJE8fZp8NA2HtgELiMs3mL03qP4pp5kakr1tZupbgFrLCM5rX7qI5GuYWs\n8yp1hn8hsnwr9vj7mLk7bkEMT+zixXZNsrydMPRBUJh7VlqGMxtaidzdMK3mnXyoHCSQ74b8LCNx\nf027dT818k/smmFTt61f8V/1BedpaAa5IiX4AAAAAElFTkSuQmCC\n", "prompt_number": 100, "text": [ " ___ \n", "\u2572\u2571 2 \u22c5\u27e81\u2758\u2a02 1" ] } ], "prompt_number": 100 }, { "cell_type": "code", "collapsed": false, "input": [ "qapply(qapply(Dagger(psi2) * e) * TensorProduct(BosonFockKet(1), IdentityOperator())).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$\\sqrt{2} \\cdot {1}\\otimes {{\\mathcal{I}}}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAAFsAAAAWBAMAAABd3v0YAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAInarRM2ZVBDdiWbv\nuzJCz3LGAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABoklEQVQ4EYVTPUsDURCcyyWXd5oiKQy2KtjG\nyjYpxFbtLC8E1EbIT3hYBCwkgiAiCkGEQAQ/WsGPwpRiGi39aCz8QC0UsTDu7rs7r1Bui9mZ2XmX\nvXcEMGV1uV59FdvsUmwkGuiLing+Gx+JJNRyRMRTpxqXOdrodt+D0CKQn78OFPWUjgiiz8d3J3eh\ntwM1gr1SGLFuwpF46gxYDae0uq2ROQ0MdVXUwtVwa4uZdYv0mzgMiX1k6MR3aKCghY9rqKZxbXMb\nY6RcWvbzj3hyioZL5hoyHh9LtAkGmcH9lCZgnm47WShvTpwXOdVfKAHmdyYa4guY+AHKqGEh4qDe\nQa/JbbKtZObv7sHp99Aj1qUZOG9wNVOnw1ifZPTjDWAGfvxLfFgfOBQ2JOiOSDPLeFAzWTjsJINr\nK+o11mkPOe6mgniNtpe4Y94PeGl6HLkHBkyU0cTHLNo8+8hGvQq6JqpUWxNa661K8ACSJu7kie7y\nern5XG6UOm3xwZii/95vvHKxsk+mmuZJFnii6XmJBBV/un+qVkW6/M/sL/uhtR21fwDvuWP3oMRm\n3QAAAABJRU5ErkJggg==\n", "prompt_number": 101, "text": [ " ___ \n", "\u2572\u2571 2 \u22c51\u2a02 I" ] } ], "prompt_number": 101 }, { "cell_type": "code", "collapsed": false, "input": [ "bra = TensorProduct(BosonFockBra(1),BosonFockBra(2))\n", "ket = TensorProduct(BosonFockKet(1),BosonFockKet(2))" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 102 }, { "cell_type": "code", "collapsed": false, "input": [ "qapply(bra * ket).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$${1}\\otimes {1}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAACsAAAAQBAMAAAB9zpudAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAzRAiu5mrdu/dZolE\nVDLjuNgcAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAs0lEQVQYGWNgYBBiQAOMCkABk09oosz+QGGV\nMKiwevTuIpACJtd8oDADO0SYJ4iBQfsCSJyhXgFIQIUPGgAV+oJEUYQTghkYVFkV0IS5DFgNmAKY\nCtCEWRkYglUZGDagCXMzMLAGYAoDVasCTQfKoFjJysAUwGqAIcxzwJSBYTPfAjTVDMFA/dzPQKJg\nd7Nm/MwCsRUVgIQwEDOE9U9bAKLBgCmWgeGqAYyHoPl27z4A5wEAqfAqOS1nfgAAAAAASUVORK5C\nYII=\n", "prompt_number": 103, "text": [ "1\u2a02 1" ] } ], "prompt_number": 103 }, { "cell_type": "code", "collapsed": false, "input": [ "e = qapply(qapply(TensorProduct(IdentityOperator(), BosonCoherentBra(2)) * \n", " TensorProduct(a, normal_ordered_form(Dagger(b)*b*Dagger(b)*b)) * \n", " TensorProduct(IdentityOperator(), BosonCoherentKet(2))))\n", "\n", "e" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$2 {{a}}\\otimes \\left({{\\left\\langle 2\\right|} {{b}^\\dagger} {\\left|2\\right\\rangle }}\\right) + 4 {{a}}\\otimes \\left({{\\left\\langle 2\\right|} \\left({{b}^\\dagger}\\right)^{2} {\\left|2\\right\\rangle }}\\right)$$" ], "metadata": {}, "output_type": "pyout", "png": "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\nX8dMEOwAAAAASUVORK5CYII=\n", "prompt_number": 104, "text": [ " \u239b 2 \u239e\n", " \u239b \u2020 \u239e \u239c \u239b \u2020\u239e \u239f\n", "2\u22c5a\u2a02 \u239d\u27e82\u2758\u22c5b \u22c5\u27582\u27e9\u23a0 + 4\u22c5a\u2a02 \u239d\u27e82\u2758\u22c5\u239db \u23a0 \u22c5\u27582\u27e9\u23a0" ] } ], "prompt_number": 104 }, { "cell_type": "code", "collapsed": false, "input": [ "ket = TensorProduct(IdentityOperator(), BosonFockKet(2))\n", "bra = Dagger(ket)\n", "\n", "qapply(qapply(bra * TensorProduct(a, normal_ordered_form(Dagger(b)*b*Dagger(b)*b)) * ket)).doit()" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$$4 {{a}}\\otimes {1}$$" ], "metadata": {}, "output_type": "pyout", "png": "iVBORw0KGgoAAAANSUhEUgAAADgAAAAQBAMAAACxV6F2AAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAMpndu3bvImbNiRBU\nq0Qb3U6NAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABD0lEQVQYGWNgYGAQAmIsYDZYzASLDANDyW+Q\nMGsKkuRWrVXRYO4WXbBkxRSEJJ82A8OuA2A+K1hyAZLkywIGBm4fhCRHAVCS/VagNUjogjoDwyam\nDSAmWOdWBqDkswKWD0ABjgKmAm4F7gC45AKgJHcGA5MDUISJgUF9EwPDAiATrJNHACjJ9JuBGaSc\nCyivgCS5iwEoyebAsF8AKAnUuQloK1AeovPs3bvfru5fwHCeYQNIkluBqQAhCVSTwrD/AIMnTwED\nA9+DIgaG5YwNMJ1A+gsDZwCHLdA+oHMUgBbLglgQrzAs+X+D++rC2jiQyE6g2QzTQSyma59vgGgk\nwK3DwHAIaD52wLhq1QO4DACvBkXDDCHzEAAAAABJRU5ErkJggg==\n", "prompt_number": 105, "text": [ "4\u22c5a\u2a02 1" ] } ], "prompt_number": 105 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Versions" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#%install_ext http://raw.github.com/jrjohansson/version_information/master/version_information.py\n", "%reload_ext version_information\n", "\n", "%version_information sympy" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "
SoftwareVersion
Python3.4.1 (default, May 21 2014, 01:39:38) [GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)]
IPython2.1.0
OSposix [darwin]
sympy0.7.4.1-git
Thu Jun 05 15:32:12 2014 JST
" ], "json": [ "{ \"Software versions\" : [{ \"module\" : \"Python\", \"version\" : \"3.4.1 (default, May 21 2014, 01:39:38) [GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)]\" }, { \"module\" : \"IPython\", \"version\" : \"2.1.0\" }, { \"module\" : \"OS\", \"version\" : \"posix [darwin]\" }, { \"module\" : \"sympy\", \"version\" : \"0.7.4.1-git\" } ] }" ], "latex": [ "\\begin{tabular}{|l|l|}\\hline\n", "{\\bf Software} & {\\bf Version} \\\\ \\hline\\hline\n", "Python & 3.4.1 (default, May 21 2014, 01:39:38) [GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] \\\\ \\hline\n", "IPython & 2.1.0 \\\\ \\hline\n", "OS & posix [darwin] \\\\ \\hline\n", "sympy & 0.7.4.1-git \\\\ \\hline\n", "\\hline \\multicolumn{2}{|l|}{Thu Jun 05 15:32:12 2014 JST} \\\\ \\hline\n", "\\end{tabular}\n" ], "metadata": {}, "output_type": "pyout", "prompt_number": 106, "text": [ "Software versions\n", "Python 3.4.1 (default, May 21 2014, 01:39:38) [GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)]\n", "IPython 2.1.0\n", "OS posix [darwin]\n", "sympy 0.7.4.1-git\n", "\n", "Thu Jun 05 15:32:12 2014 JST" ] } ], "prompt_number": 106 } ], "metadata": {} } ] }