Re: Grassmann Calculus / Indexed Objects / Simplify
- To: mathgroup at smc.vnet.net
- Subject: [mg60832] Re: Grassmann Calculus / Indexed Objects / Simplify
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Thu, 29 Sep 2005 05:43:41 -0400 (EDT)
- References: <dhdank$8ae$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Robert Schoefbeck wrote: > Hello all, > > I want to implement superspace calculations in a mathematica package. > I define (code below) grassmannian theta-variables with upper and lower, > dotted and undotted indices. Having declared (anti)- commutativity > with DeclareOdd i use myTimes to handle multiplications of Superfields. > > Dummy indices are generated by use of Unique[]. All this multiplication > stuff works pretty well but looking at the one but last output i have > the problem that contractions with different dummies are not recognized > as equal. > > My questions are: Is there a way to tell mathematica to keep the > information that indices are equal but forgetting about the name of the > dummy? > > I'd also like to pull indices with metrics, something like > > e[a,b]theta[b]=theta[a] > > How should i implement the defining relations for index pulling > (i have vector, and chiral/antichiral spinor indices, color indices and > so on) such that 1) Simplify can handle them? > > any help is welcome, does maybe someone have a sample application of how > to handle indices? > i'd also appreciate any comment on the code. > > robert schoefbeck > > > > > short description: > > OddPQ tests whether an object has odd parity or not > > mytimes handles ,multiplications > > CSF[phi,lambda,F] ... chiral superfield defined by component fields > (lambda is odd) > ACSF ... antichiral Superfield > > > Code: > > > > Notebook[{ > Cell[BoxData[ > \(\(Clear[myTimes];\)\)], "Input"], > > Cell[BoxData[ > \(\(\(Clear[DeclareOdd, OddPQ, myTimes]\[IndentingNewLine] > \(DeclareOdd[ > var__] := \(\((OddPQ[#] = > True)\) &\) /@ {var};\)\[IndentingNewLine] > \(\(DeclareEven[ > var__] := \(\((OddPQ[#] = > False)\) &\) /@ {var};\)\(\[IndentingNewLine]\) > \)\)\( (*OddPQ[myTimes[x__]] := > Mod[Count[OddPQ /@ {x}, True], 2] \[Equal] > 1*) \)\)\)], "Input"], > > Cell[BoxData[ > \(\(DeclareOdd[\[Theta][\[Alpha]_], \[Theta]b[\[Alpha]_]];\)\)], \ > "Input"], > > Cell[BoxData[ > \(\(OddPQ[x_?NumericQ] := False;\)\)], "Input"], > > Cell[BoxData[ > \(\(DeclareOdd[\[Theta][\[Alpha]_], \[Theta]b[\[Alpha]_]];\)\)], \ > "Input"], > > Cell["rearranging of elementary Odd variables", "Text"], > > Cell[BoxData[{ > \(myTimes[a___, x_, b___, x_, c___] /; OddPQ[x] := > 0\), "\[IndentingNewLine]", > \(myTimes[x___] /; \((And @@ \(OddPQ /@ {x}\))\) && > Not[OrderedQ[{x}]] := > Signature[{x}]*myTimes[Sequence @@ Sort[{x}]]\)}], "Input"], > > Cell["linearity", "Text"], > > Cell[BoxData[ > \(myTimes[x___, y_Plus, z___] := \(myTimes[x, #, z] &\) /@ > y\)], "Input"], > > Cell[BoxData[ > \(myTimes[x___, y_Times, z___] := > myTimes[x, Apply[Sequence, y], z]\)], "Input"], > > Cell[BoxData[ > \(myTimes[x___, y_myTimes, z___] := > myTimes[x, Apply[Sequence, y], z]\)], "Input"], > > Cell["a single expression in mytimes whose head is not myTimes", \ > "Text"], > > Cell[BoxData[ > \(myTimes[a_] /; Head[a] =!= Times := a\)], "Input"], > > Cell["\<\ > after linearity downvalues: myTimes\[Rule]Times if possible\ > \>", "Text"], > > Cell[BoxData[ > \(myTimes[a_, b_] /; \(! OddPQ[a]\) || \(! OddPQ[b]\) := > a*b\)], "Input"], > > Cell[BoxData[ > \(\(myTimes[] = 1;\)\)], "Input"], > > Cell["\<\ > split off avars in myTimes (corrected version: Length[coms>0])\ > \>", "Text"], > > Cell[BoxData[ > \(myTimes[vars__] /; Length[{vars}] > 2 := > Module[{vl = {vars}, antis, coms, exponents}, > antis = Select[vl, OddPQ]; \[IndentingNewLine]coms = > Complement[vl, > antis]; \[IndentingNewLine]exponents = \(Count[ > vl, #] &\) /@ > coms; \[IndentingNewLine]Inner[Power, coms, exponents, > Times]*Apply[myTimes, antis] /; > Length[coms] > 0]\)], "Input"], > > Cell["4-dim chiral thetas", "Text"], > > Cell[BoxData[ > \(myTimes[ > x___] /; \((Length[{x}] > 2 && > Max\ [\(Count[{x}, #[_]] &\) /@ > Union[Select[{x}, OddPQ] /. > f_[_] \[RuleDelayed] f]] > 2)\) := > 0\)], "Input"], > > Cell["END", "Text"], > > Cell[BoxData[ > \(\(DeclareOdd[\[Theta][_], \[Theta]b[_]];\)\)], "Input"], > > Cell[BoxData[{ > \(\(Format[\[Theta]b[ > Index[\[Alpha]_, > down]]] := \[Theta]\&_\_\[Alpha]\& . ;\)\), "\ > \[IndentingNewLine]", > \(\(Format[\[Theta]b[ > Index[\[Alpha]_, > up]]] := \[Theta]\&_\^\[Alpha]\& . ;\)\)}], "Input"], > > Cell[BoxData[{ > \(\(Format[\[Theta][ > Index[\[Alpha]_, > down]]] := \[Theta]\_\[Alpha];\)\), \ > "\[IndentingNewLine]", > \(\(Format[\[Theta][ > Index[\[Alpha]_, > up]]] := \[Theta]\^\[Alpha];\)\)}], "Input"], > > Cell[BoxData[ > \(Format[myConjugate[x_]] := x\&_\)], "Input"], > > Cell[BoxData[{ > \(\(Clear[CSF];\)\), "\[IndentingNewLine]", > \(\(\(CSF[0, 0, F_Symbol] := > Module[{ad1, au1}, indid1 = Unique[\[Alpha]]; > ad1 = Index[indid1, down]; > au1 = Index[indid1, > up]; \[IndentingNewLine]F\ myTimes[\[Theta][ > ad1], \[Theta][au1]]]\)\(\[IndentingNewLine]\) > \)\)}], "Input"], > > Cell[BoxData[ > \(\(CSF[\[Phi]_Symbol, \[Lambda]_Symbol, F_Symbol] := > Module[{ad1, ad2, au1, au2, indid1, indid2}, > indid1 = Unique[\[Alpha]]; indid2 = Unique[\[Alpha]]; > ad1 = Index[indid1, down]; au1 = Index[indid1, up]; > ad2 = Index[indid2, down]; > au2 = Index[indid2, > up]; \[IndentingNewLine]DeclareOdd[\[Lambda][_]]; \ > \[IndentingNewLine]DeclareEven[\[Phi]]; \[IndentingNewLine]Format[\ > \[Lambda][Index[\[Alpha]_, > down]]] := \[Lambda]\_\[Alpha]; \ > \[IndentingNewLine]Format[\[Lambda][ > Index[\[Alpha]_, > up]]] := \[Lambda]\^\[Alpha]; \[IndentingNewLine]\ > \[Phi] + Sqrt[2] myTimes[\[Theta][au1], \[Lambda][ad1]] + > F\ myTimes[\[Theta][au2], \[Theta][ > ad2]]];\)\)], "Input"], > > Cell[BoxData[ > \(\(ACSF[\[Phi]_Symbol, \[Lambda]_Symbol, F_Symbol] := > Module[{ad1, ad2, au1, au2, indid1, indid2}, > indid1 = Unique[\[Alpha]]; indid2 = Unique[\[Alpha]]; > au1 = Index[indid1, up]; ad1 = Index[indid1, down]; > au2 = Index[indid2, up]; > ad2 = Index[indid2, > down]; \[IndentingNewLine]DeclareOdd[\[Lambda][_]]; \ > \[IndentingNewLine]DeclareEven[\[Phi]]; \ > \[IndentingNewLine]Format[\(myConjugate[\[Lambda]]\)[ > Index[\[Alpha]_, > down]]] := \[Lambda]\&_\_\[Alpha]\& . ; \ > \[IndentingNewLine]Format[\(myConjugate[\[Lambda]]\)[ > Index[\[Alpha]_, > up]]] := \[Lambda]\&_\^\[Alpha]\& . ; \ > \[IndentingNewLine]myConjugate[\[Phi]] + > Sqrt[2] > myTimes[\[Theta]b[ad1], \(myConjugate[\[Lambda]]\)[ > au1]] + > myConjugate[ > F]\ myTimes[\[Theta]b[ad2], \[Theta]b[ > au2]]];\)\)], "Input"], > > Cell[CellGroupData[{ > > Cell[BoxData[ > \(CSF[\[Phi], \[Lambda], F]\)], "Input"], > > Cell[BoxData[ > FormBox[ > RowBox[{"\[Phi]", "+", > RowBox[{\(\@2\), " ", > RowBox[{"myTimes", "(", > RowBox[{ > FormBox[\(\[Theta]\^\[Alpha]$792\), > "TraditionalForm"], ",", > FormBox[\(\[Lambda]\_\[Alpha]$792\), > "TraditionalForm"]}], ")"}]}], "-", > RowBox[{"F", " ", > RowBox[{"myTimes", "(", > RowBox[{ > FormBox[\(\[Theta]\_\[Alpha]$793\), > "TraditionalForm"], ",", > FormBox[\(\[Theta]\^\[Alpha]$793\), > "TraditionalForm"]}], ")"}]}]}], > TraditionalForm]], "Output"] > }, Open ]], > > Cell[CellGroupData[{ > > Cell[BoxData[ > \(myTimes[CSF[\[Phi], \[Lambda], F], > CSF[\[Phi], \[Lambda], F]]\)], "Input"], > > Cell[BoxData[ > FormBox[ > RowBox[{\(\[Phi]\^2\), "+", > RowBox[{\(\@2\), " ", > RowBox[{"myTimes", "(", > RowBox[{ > FormBox[\(\[Theta]\^\[Alpha]$795\), > "TraditionalForm"], ",", > FormBox[\(\[Lambda]\_\[Alpha]$795\), > "TraditionalForm"]}], ")"}], " ", "\[Phi]"}], "-", > RowBox[{"F", " ", > RowBox[{"myTimes", "(", > RowBox[{ > FormBox[\(\[Theta]\_\[Alpha]$796\), > "TraditionalForm"], ",", > FormBox[\(\[Theta]\^\[Alpha]$796\), > "TraditionalForm"]}], ")"}], " ", "\[Phi]"}], "+", > RowBox[{\(\@2\), " ", > RowBox[{"myTimes", "(", > RowBox[{ > FormBox[\(\[Theta]\^\[Alpha]$798\), > "TraditionalForm"], ",", > FormBox[\(\[Lambda]\_\[Alpha]$798\), > "TraditionalForm"]}], ")"}], " ", "\[Phi]"}], "-", > RowBox[{"F", " ", > RowBox[{"myTimes", "(", > RowBox[{ > FormBox[\(\[Theta]\_\[Alpha]$799\), > "TraditionalForm"], ",", > FormBox[\(\[Theta]\^\[Alpha]$799\), > "TraditionalForm"]}], ")"}], " ", "\[Phi]"}], "-", > RowBox[{"2", " ", > RowBox[{"myTimes", "(", > RowBox[{ > FormBox[\(\[Theta]\^\[Alpha]$795\), > "TraditionalForm"], ",", > FormBox[\(\[Theta]\^\[Alpha]$798\), > "TraditionalForm"], ",", > FormBox[\(\[Lambda]\_\[Alpha]$795\), > "TraditionalForm"], ",", > FormBox[\(\[Lambda]\_\[Alpha]$798\), > "TraditionalForm"]}], ")"}]}]}], > TraditionalForm]], "Output"] > }, Open ]], > > Cell[CellGroupData[{ > > Cell[BoxData[ > \(myTimes[ACSF[\[Phi], \[Lambda], F], > CSF[\[Phi], \[Lambda], F]]\)], "Input"], > > Cell[BoxData[ > FormBox[ > RowBox[{ > RowBox[{"\[Phi]", " ", > FormBox[\(\[Phi]\&_\), > "TraditionalForm"]}], "+", > RowBox[{\(\@2\), " ", > RowBox[{"myTimes", "(", > RowBox[{ > FormBox[\(\[Theta]\^\[Alpha]$816\), > "TraditionalForm"], ",", > FormBox[\(\[Lambda]\_\[Alpha]$816\), > "TraditionalForm"]}], ")"}], " ", > FormBox[\(\[Phi]\&_\), > "TraditionalForm"]}], "-", > RowBox[{"F", " ", > RowBox[{"myTimes", "(", > RowBox[{ > FormBox[\(\[Theta]\_\[Alpha]$817\), > "TraditionalForm"], ",", > FormBox[\(\[Theta]\^\[Alpha]$817\), > "TraditionalForm"]}], ")"}], " ", > FormBox[\(\[Phi]\&_\), > "TraditionalForm"]}], "+", > RowBox[{"\[Phi]", " ", > FormBox[\(F\&_\), > "TraditionalForm"], " ", > RowBox[{"myTimes", "(", > RowBox[{ > FormBox[\(\[Theta]\&_\_\(\[Alpha]$814\& . \)\), > "TraditionalForm"], ",", > FormBox[\(\[Theta]\&_\^\(\[Alpha]$814\& . \)\), > "TraditionalForm"]}], ")"}]}], "+", > RowBox[{\(\@2\), " ", > FormBox[\(F\&_\), > "TraditionalForm"], " ", > RowBox[{"myTimes", "(", > RowBox[{ > FormBox[\(\[Theta]\^\[Alpha]$816\), > "TraditionalForm"], ",", > FormBox[\(\[Theta]\&_\_\(\[Alpha]$814\& . \)\), > "TraditionalForm"], ",", > FormBox[\(\[Theta]\&_\^\(\[Alpha]$814\& . \)\), > "TraditionalForm"], ",", > FormBox[\(\[Lambda]\_\[Alpha]$816\), > "TraditionalForm"]}], ")"}]}], "-", > RowBox[{"F", " ", > FormBox[\(F\&_\), > "TraditionalForm"], " ", > RowBox[{"myTimes", "(", > RowBox[{ > FormBox[\(\[Theta]\_\[Alpha]$817\), > "TraditionalForm"], ",", > FormBox[\(\[Theta]\^\[Alpha]$817\), > "TraditionalForm"], ",", > FormBox[\(\[Theta]\&_\_\(\[Alpha]$814\& . \)\), > "TraditionalForm"], ",", > FormBox[\(\[Theta]\&_\^\(\[Alpha]$814\& . \)\), > "TraditionalForm"]}], ")"}]}], "-", > RowBox[{"2", " ", > RowBox[{"myTimes", "(", > RowBox[{ > FormBox[\(\[Theta]\^\[Alpha]$816\), > "TraditionalForm"], ",", > FormBox[\(\[Theta]\&_\_\(\[Alpha]$813\& . \)\), > "TraditionalForm"], ",", > FormBox[\(\[Lambda]\_\[Alpha]$816\), > "TraditionalForm"]}], ")"}], " ", > FormBox[\(\[Lambda]\&_\^\(\[Alpha]$813\& . \)\), > "TraditionalForm"]}], "-", > RowBox[{\(\@2\), " ", "F", " ", > RowBox[{"myTimes", "(", > RowBox[{ > FormBox[\(\[Theta]\_\[Alpha]$817\), > "TraditionalForm"], ",", > FormBox[\(\[Theta]\^\[Alpha]$817\), > "TraditionalForm"], ",", > FormBox[\(\[Theta]\&_\_\(\[Alpha]$813\& . \)\), > "TraditionalForm"]}], ")"}], " ", > FormBox[\(\[Lambda]\&_\^\(\[Alpha]$813\& . \)\), > "TraditionalForm"]}], "+", > RowBox[{\(\@2\), " ", "\[Phi]", " ", > FormBox[\(\[Theta]\&_\_\(\[Alpha]$813\& . \)\), > "TraditionalForm"], " ", > FormBox[\(\[Lambda]\&_\^\(\[Alpha]$813\& . \)\), > "TraditionalForm"]}]}], TraditionalForm]], "Output"] > }, Open ]] > } > ] > > Hi, Most of this is way out of my depth, but if you want to keep information about a repeated index, but forgetting the name of the dummy (presumably in case you use the same name somewhere else later), why not use Unique[] or just replace the variable with a private module variable. These are always unique and are not garbage collected if the have been incorporated in a larger structure. David Bailey http://www.dbaileyconsultancy.co.uk