Re: Commutators with boson operators
- To: mathgroup at smc.vnet.net
- Subject: [mg97878] Re: Commutators with boson operators
- From: Sotirios Bonanos <sbonano at inp.demokritos.gr>
- Date: Tue, 24 Mar 2009 05:33:29 -0500 (EST)
Hi there, This is precisely the type of problems that the symbolic matrix capabilities of my EDC package (http://www.inp.demokritos.gr/~sbonano/EDC/) can handle. It is rather slow but does what you want. Download the code (matrixEDC.m), put it in an appropriate directory, and evaluate the attached notebook. Sotirios Bonanos > Hello, > I need some help. > > I want to write code that Mathematica would calculate commutators [A,B], [A,[B,C]] and so on..., > > where A,B,C,D,... are functions like > > A = a+ b*creat + c*annih + d*creat**annih + e*annih**creat + f*creat^2+g*annih^2+... > > where a,b,c,d,... are usual complex numbers; > > and annih & creat are boson noncommutative operators > that satisfy commutation relation: > [annih, creat] = 1. > > Thank you in advance! CreatAnnih.nb (************** Content-type: application/mathematica ************** CreatedBy='Mathematica 5.2' Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info at wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. *******************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 4792, 174]*) (*NotebookOutlinePosition[ 5449, 197]*) (* CellTagsIndexPosition[ 5405, 193]*) (*WindowFrame->Normal*) Notebook[{ Cell[BoxData[ \(<< matrixEDC.m\)], "Input"], Cell[BoxData[ \(DeclareMatrixForms[{0, annih[_], annih[_]}, {0, creat[_], creat[_]}]\)], "Input"], Cell[BoxData[ \(annih[n]\ and\ creat[ n]\ will\ denote\ the\ nth\ powers\ of\ your\ operators . \ \ \ \[IndentingNewLine]Wedge \((\[Wedge])\)\ is\ used\ to\ denote\ non - commutative\ \ multiplication\)], "Text", FontFamily->"Times"], Cell[BoxData[ \(Wedge[creat[1], annih[1]]\)], "Input"], Cell["\<\ Give rules for simplifying Wedge products of powers of creat, annih\ \ \>", "Text"], Cell[BoxData[ \(creat[0] = 1; annih[0] = 1;\)], "Input"], Cell[BoxData[ \(Wedge[creat[m_], creat[n_]] := creat[m + n]\)], "Input"], Cell[BoxData[ \(Wedge[annih[m_], annih[n_]] := annih[m + n]\)], "Input"], Cell[BoxData[ \(Wedge[creat[m_], annih[n_]] := Wedge[creat[m - 1], annih[1]\[Wedge]creat[1] - h0, annih[n - 1]] /; m > 0 && n > 0\)], "Input"], Cell["\<\ The last rule implements the commutator \ creat[1]\[Wedge]annih[1]-annih[1]\[Wedge]creat[1] = -h0; (h0 = 1 in your \ case) to put annih[] operators before creat[] ones. If you prefer to have \ creat[] before annih[] use: Wedge[annih[m_],creat[n_]]:=Wedge[annih[m-1], \ creat[1]\[Wedge]annih[1]+h0, creat[n-1]]/;m>0&&n>0\ \>", "Text"], Cell[BoxData[ \(h0 = 1\)], "Input"], Cell[BoxData[ \(\[IndentingNewLine]\)], "Input"], Cell["Examples", "Text"], Cell[BoxData[ \(Wedge[creat[1], annih[1]]\)], "Input"], Cell[BoxData[ \(Wedge[creat[1], annih[2]]\)], "Input"], Cell[BoxData[ \(Wedge[creat[2], annih[1]]\)], "Input"], Cell[BoxData[""], "Input"], Cell[BoxData[ \(A = Sum[aa[i, j] Wedge[creat[i], annih[j]], {i, 0, 2}, {j, 0, 2}]\)], "Input"], Cell["\<\ The function reWrite collects identical annih, creat powers / \ products\ \>", "Text"], Cell[BoxData[ \(A = reWrite[A]\)], "Input"], Cell[BoxData[ \(B = reWrite[Sum[ bb[i, j] Wedge[creat[i], annih[j]], {i, 0, 2}, {j, 0, 3}]]\)], "Input"], Cell[BoxData[ \(\(\(CC\)\(=\)\(reWrite[ Sum[cc[i, j] Wedge[creat[i], annih[j]], {i, 0, 3}, {j, 0, 2}]]\)\( (*\(*\)\(\ \)\("\<Symbol C is Protected\>"\)\ **) \ \)\)\)], "Input"], Cell[BoxData[ \(\[IndentingNewLine]\)], "Input"], Cell["Define commutator", "Text"], Cell[BoxData[ \(comm[x_, y_] := reWrite[x\[Wedge]y - y\[Wedge]x]\)], "Input"], Cell[BoxData[ \(comm[A, B]\)], "Input"], Cell[BoxData[ \(comm[A, CC]\)], "Input"], Cell[BoxData[ \(\(\(comm[A, comm[B, CC]]\)\( (*\(*\)\(\ \)\(This\)\(\ \)\(takes\)\(\ \)\(long!\)\ **) \ \)\)\)], "Input"], Cell[BoxData[ \(\[IndentingNewLine]\)], "Input"], Cell["Define Jacobi", "Text"], Cell[BoxData[ \(Jacobi[x_, y_, z_] := reWrite[comm[x, comm[y, z]] + comm[y, comm[z, x]] + comm[z, comm[x, y]]]\)], "Input"], Cell[BoxData[ \(\(\(Jacobi[A, B, CC]\)\( (*\(*\)\(\ \)\(This\)\(\ \)\(takes\)\(\ \)\(long!\)\ **) \ \)\)\)], "Input"] }, FrontEndVersion->"5.2 for Macintosh", ScreenRectangle->{{43, 1152}, {0, 842}}, WindowSize->{910, 719}, WindowMargins->{{4, Automatic}, {Automatic, 1}}, Magnification->1.25 ] (******************************************************************* Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. *******************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[1754, 51, 47, 1, 33, "Input"], Cell[1804, 54, 110, 2, 33, "Input"], Cell[1917, 58, 256, 5, 54, "Text"], Cell[2176, 65, 58, 1, 33, "Input"], Cell[2237, 68, 93, 3, 36, "Text"], Cell[2333, 73, 60, 1, 33, "Input"], Cell[2396, 76, 76, 1, 33, "Input"], Cell[2475, 79, 76, 1, 33, "Input"], Cell[2554, 82, 162, 3, 52, "Input"], Cell[2719, 87, 351, 7, 74, "Text"], Cell[3073, 96, 39, 1, 33, "Input"], Cell[3115, 99, 52, 1, 52, "Input"], Cell[3170, 102, 24, 0, 36, "Text"], Cell[3197, 104, 58, 1, 33, "Input"], Cell[3258, 107, 58, 1, 33, "Input"], Cell[3319, 110, 58, 1, 33, "Input"], Cell[3380, 113, 26, 0, 33, "Input"], Cell[3409, 115, 116, 3, 33, "Input"], Cell[3528, 120, 96, 3, 36, "Text"], Cell[3627, 125, 47, 1, 33, "Input"], Cell[3677, 128, 138, 4, 33, "Input"], Cell[3818, 134, 201, 4, 52, "Input"], Cell[4022, 140, 52, 1, 52, "Input"], Cell[4077, 143, 33, 0, 36, "Text"], Cell[4113, 145, 81, 1, 33, "Input"], Cell[4197, 148, 43, 1, 33, "Input"], Cell[4243, 151, 44, 1, 28, "Input"], Cell[4290, 154, 132, 3, 28, "Input"], Cell[4425, 159, 52, 1, 47, "Input"], Cell[4480, 162, 29, 0, 36, "Text"], Cell[4512, 164, 145, 3, 52, "Input"], Cell[4660, 169, 128, 3, 33, "Input"] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)