Re: Grassmann Calculus / Indexed Objects / Simplify
- To: mathgroup at smc.vnet.net
- Subject: [mg60811] Re: Grassmann Calculus / Indexed Objects / Simplify
- From: dh <dh at metrohm.ch>
- Date: Thu, 29 Sep 2005 05:41:31 -0400 (EDT)
- References: <dhdank$8ae$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hello Robert,
I assume you are using conventions from relativity about repeated indices.
1. Question:
Not that I understand everything in your code, but
as far as I can see you are using unique indices only in CSF and ACSF.
And there you are using them only to denote contractions. Well, the name
of the index in a contraction is unimportant and you can as well name
them always the same, e.g. \alpha
2. Question: e[a,b]theta[b]=theta[a]
this can be easily achieved by a rule, e.g.:
e/: e[a_,b_]theta[b_]:=theta[a]
here e/: is used to assigne the rule to e.
sincerely, Daniel
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 ]]
> }
> ]
>
>