System`MyBeginPackage[a_,b___] := (NoPrint["MB ", a]; Hold[BeginPackage][a,b]//ReleaseHold); System`MyEndPackage[] := (NoPrint["EE ", Context[]]; EndPackage[]); (* F E Y N C A L C 4.1.2 *) HighEnergyPhysics`FeynCalc`$FeynCalcVersion = "4.1.2"; (* This software is GPL-ed, see: http://www.feyncalc.org/licence.txt *) (* ------------------------------------------------------------------------ *) (* Clear all definitions. Added 21/9-2000 by F.Orellana to ease debugging *) (* ------------------------------------------------------------------------ *) If[MemberQ[$Packages,"HighEnergyPhysics`FeynCalc`"], Block[{fcallpaths,fcallsymbols,rl,fcv,fcd}, fcv = HighEnergyPhysics`FeynCalc`$FeynCalcVersion; fcd = HighEnergyPhysics`FeynCalc`$FeynCalcDirectory; fcvv = HighEnergyPhysics`FeynCalc`$VeryVerbose; If[HighEnergyPhysics`FeynCalc`$VeryVerbose>0, rl=True; If[$Notebooks===True, CellPrint[Cell[TextData[{"Clearing all definitions"}], "Text"]], Print["Clearing all definitions"]] ]; fcallpaths = Select[$ContextPath, (StringMatchQ[#, "HighEnergyPhysics`FeynCalc`*"] || StringMatchQ[#, "HighEnergyPhysics`fctables`*"] || StringMatchQ[#, "HighEnergyPhysics`fctables`*"] || StringMatchQ[#, "HighEnergyPhysics`fctools`*"] || StringMatchQ[#, "HighEnergyPhysics`general`*"] || StringMatchQ[#, "HighEnergyPhysics`qcd`*"])&]; fcallsymbols = (Join[StringJoin[#, "*"] & /@ #, StringJoin[#, "*`*"] & /@ #, StringJoin[#, "*`*`*"] & /@ #]) &[fcallpaths]; (* ClearAll /@ fcallsymbols; *) Unprotect[$Packages]; $Packages = Complement[$Packages, fcallpaths]; Protect[$Packages]; $ContextPath = Complement[$ContextPath, fcallpaths]; If[rl===True, If[$Notebooks===True, CellPrint[Cell[TextData[{"Reloading FeynCalc"}], "Text"]], Print["Reloading FeynCalc"]] ]; HighEnergyPhysics`FeynCalc`$FeynCalcVersion = fcv; HighEnergyPhysics`FeynCalc`$FeynCalcDirectory = fcd; HighEnergyPhysics`FeynCalc`$VeryVerbose = fcvv; ]; ]; (* ------------------------------------------------------------------------ *) (* ------------------------------------------------------------------------ *) (* Find out where HighEnergyPhysics is installed *) (* ------------------------------------------------------------------------ *) (* Added support for loading from "~/.Mathematica" and "." . This is not exactly the correct FileNames syntax and workds only under Unix. This is ok, since that's the only system under which $HomeDirectory is defined. Frederik Orellana, 31/7-2000 *) If[!ValueQ[HighEnergyPhysics`FeynCalc`$FeynCalcDirectory], Which[ (HighEnergyPhysics`FeynCalc`$FeynCalcDirectory = FileNames["FeynCalc.m",{Directory[]}]) != {}, HighEnergyPhysics`FeynCalc`$FeynCalcDirectory = Directory[]; If[MemberQ[$Path,Evaluate[ParentDirectory[Directory[]]]]!=True, $Path=Append[$Path,ParentDirectory[Directory[]]]], (HighEnergyPhysics`FeynCalc`$FeynCalcDirectory = FileNames["HighEnergyPhysics",{Directory[]}]) != {}, HighEnergyPhysics`FeynCalc`$FeynCalcDirectory = HighEnergyPhysics`FeynCalc`$FeynCalcDirectory[[1]]; If[MemberQ[$Path,Evaluate[ParentDirectory[ HighEnergyPhysics`FeynCalc`$FeynCalcDirectory]]]!=True, $Path=Append[$Path,ParentDirectory[HighEnergyPhysics`FeynCalc`$FeynCalcDirectory]]], (HighEnergyPhysics`FeynCalc`$FeynCalcDirectory = FileNames[$HomeDirectory <> $PathnameSeparator <> ".Mathematica" <> $PathnameSeparator <> "*" <> $PathnameSeparator <> "AddOns" <> $PathnameSeparator <> "Applications" <> $PathnameSeparator <> "HighEnergyPhysics"]) != {} && FileNames[HighEnergyPhysics`FeynCalc`$FeynCalcDirectory[[1]]<> $PathnameSeparator <> "FeynCalc.m"] != {}, HighEnergyPhysics`FeynCalc`$FeynCalcDirectory = HighEnergyPhysics`FeynCalc`$FeynCalcDirectory[[1]], True, HighEnergyPhysics`FeynCalc`$FeynCalcDirectory = ToFileName[{$TopDirectory, "AddOns", "Applications", "HighEnergyPhysics"}] ] ]; If[FileNames["*",{HighEnergyPhysics`FeynCalc`$FeynCalcDirectory}] == {}, Print["Could not find FeynCalc installation. Quitting the Mathematica kernel."]; Quit[]; Exit[]; ]; (* ------------------------------------------------------------------------ *) HighEnergyPhysics`FeynCalc`$ExcludeAutomaticDeclarePackageDirectories= {"tarcer", "Phi", ".AppleDouble", "FeynArts", "GraphInfo", "Models", "documentation", "Documentation"}; HighEnergyPhysics`FeynCalc`Private`configfile= "FCConfig.m"; SetDirectory[HighEnergyPhysics`FeynCalc`$FeynCalcDirectory]; If[ FileNames[HighEnergyPhysics`FeynCalc`Private`configfile] =!= {}, Get@HighEnergyPhysics`FeynCalc`Private`configfile; ]; ResetDirectory[]; (* AUTHOR (rolfm@xs4all.nl) *) (* :Title: FeynCalc *) (* :Author: Rolf Mertig (rolfm@xs4all.nl) *) (* :Summary: Tools and Tables *) (* This file contains a lot of basic and small subpackages, all in the Context HighEnergyPhysics`FeynCalc` *) (* :Mathematica Version 3.0 or higher *) (* :History: Version 1.0 written 1991 by Rolf Mertig. Version 3.0 includes typesetting features of Mathematica 3.0 Version 3.0.1.1 includes two bug-fixes for OneLoop Version 4.1.0 : reorganized for open-source and extensibility *) If[($VersionNumber < 3.0), Print["You need Mathematica 3.0 to run FeynCalc 3.0. Quitting the Mathematica kernel."]; Quit[]; Exit[]; ]; (* From Mathematica 4.0 onwards there is "Tr" functions; we'll just rename it in FeynCalc *) If[$VersionNumber>3.4, Unprotect@@{ToExpression["Tr"]}; Remove@@{ToExpression["Tr"]}, Scan[ {Remove @@ Names["Global`"<>#], ToExpression["System`"<>#]}&, { "CommonDefaultFormatTypes" }]; ]; savethisdir=Directory[]; HighEnergyPhysics`FeynCalc`Private`feyncalchepdir = HighEnergyPhysics`FeynCalc`$FeynCalcDirectory; SetDirectory[HighEnergyPhysics`FeynCalc`Private`feyncalchepdir]; If[Global`$LoadTARCER ===True, SetDirectory["tarcer"]; If[StringQ[ Global`$LoadTARCER ], HighEnergyPhysics`FeynCalc`Private`tarcerfilenames = {Global`$LoadTARCER}, HighEnergyPhysics`FeynCalc`Private`tarcerfilenames = FileNames["tarcer*.mx",IgnoreCase->True]; ]; ResetDirectory[]; If[HighEnergyPhysics`FeynCalc`Private`tarcerfilenames=!={}, tarcerloadedflag = True; If[Global`$FeynCalcStartupMessages=!=False, If[$Notebooks ===True, CellPrint[Cell[TextData[{"Loading TARCER ", HighEnergyPhysics`FeynCalc`Private`tarcerfilenames//Last}], "Text"]], Print["Loading TARCER ", HighEnergyPhysics`FeynCalc`Private`tarcerfilenames//Last] ]; Get[Last[HighEnergyPhysics`FeynCalc`Private`tarcerfilenames]]; ]; Clear[HighEnergyPhysics`FeynCalc`Private`tarcerfilenames];, If[$Notebooks ===True, txt = {"WARNING! No TARCER*.mx file found. Please evaluate ", ButtonBox["the notebook TARCER.nb", ButtonFunction.NotebookOpen1[ ToFileName[{HighEnergyPhysics`FeynCalc`$FeynCalcDirectory, "tarcer"}, "TARCER.nb"]], ButtonStyle -> "Hyperlink", ButtonNote -> "Open the notebook TARCER.nb"], " or get one of the preprocessed files at ", ButtonBox["www.feyncalc.org/tarcer", ButtonData :> {URL["http://www.feyncalc.org/tarcer"], None}, ButtonStyle -> "Hyperlink", ButtonNote -> "http://www.feyncalc.org/tarcer"]} /. Dot -> RuleDelayed /. NotebookOpen1 -> NotebookOpen; CellPrint[ Cell[TextData[txt], "Text"]];Clear[txt,NotebookOpen1];, Print["WARNING! No TARCER*.mx file found. Please evaluate \ the notebook TARCER.nb or get one of the preprocessed files at \ http://www.feyncalc.org/tarcer"]; ]; ]; ]; SetDirectory[savethisdir]; Clear[savethisdir]; (* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX *) (* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX *) MyBeginPackage["HighEnergyPhysics`FeynCalc`"]; CheckContext::usage= "CheckContext[string] yields True if the packaged associated with string is already loaded, and False otherwise."; If[$VersionNumber<4.0, FeynCalc::usage= (* "This is FeynCalc by Rolf Mertig (visit www.feyncalc.com). *) "For installation notes visit www.feyncalc.org\n For a list of availabe objects type: $FeynCalcStuff, which contains a list of all functions and options in StringForm. You can get on-line information by ?function, (e.g.; ?Contract). Eventually you have to first enter the command function once (e.g., type Contract and hit Return), which loads the necessary libraries, and the ?function (?Contract) will work.\n\n There are several useful functions for short input, type $FCS for a list of short commands. Then type, e.g., ?GA.\n \n To get rid of the start-up messages put the line \n $FeynCalcStartupMessages = False; \n into your init.m or the HighEnergyPhysics/FCConfig.m file.", FeynCalc::usage= "For installation notes visit www.feyncalc.org\n For a list of availabe objects type: $FeynCalcStuff, which contains a list of all functions and options in StringForm. You can get on-line information by ?function, e.g., ?Contract.\n There are several useful functions for short input, type $FCS for a list of short commands. Then type, e.g., ?GA.\n \n To get rid of the start-up messages put the line \n $FeynCalcStartupMessages = False; \n into your init.m or the HighEnergyPhysics/FeynCalcConfig.m file." ]; (* F21::usage="F21 is an abbreviation for Hypergeometric2F1."; *) Li2::usage="Li2 is an abbreviation for the dilog function, i.e., Li2 = PolyLog[2,#]&."; Li3::usage="Li3 is an abbreviation for the trilog function, i.e., Li3 = PolyLog[3,#]&."; FI::usage= "FI changes the output format to InputForm. This is useful to see the internal representation of FeynCalc objects. To change back to FeynCalcForm use FC."; FC::usage= "FC changes the output format to FeynCalcForm. To change to InputForm use FI."; (* FCInstall::usage= "After running the installation program fcinst.m from within Mathematica you can customize your fc.m file. Of course you can also rename and replace fc.m. Most of the source code of FeynCalc is located in the directory FeynCalc in the HighEnergyPhysics directory. These functions are loaded on demand; i.e., when you first invoke a function it may take some time before everything is loaded. \n $FeynCalcDirectory is set (in fc.m) to the installation directory."; *) Load::usage= "Load[function] loads a function ( = Get[HighEnergyPhysics`FeynCalc`function`] )"; MakeContext::usage= "MakeContext[string] constructs the context path of string. MakeContext is invoked at startup of FeynCalc. MakeContext[a, b] construct the context path of b defined in context a."; SPC::usage= "SPC is an abbreviation for ScalarProductCancel."; SPL::usage= "SPL is an abbreviation for SimplifyPolyLog."; SubContext::usage= "SubContext[fun] gives the sub-directory (context) in HighEnergyPhysics."; $V0::usage="V0 is equivalent to $VeryVerbose = 0."; $V3::usage="V0 is equivalent to $VeryVerbose = 3."; $AL::usage= "$AL is the head for dummy indices which may be introduced by Uncontract."; $Color::usage= "$Color is False by default. If set to True, some special variables will be colored."; $Covariant::usage = "The boolean setting of $Covariant determines whether lorentz indices are displayed as lower indices (True) or as upper ones (False)."; (*$FeynCalc$::usage= "$FeynCalc$ is a list of all $-Variables in FeynCalc."; *) $FeynCalcStuff::usage= "$FeynCalcStuff is the list of availabe stuff in FeynCalc."; $FeynCalcCreationDate::usage= "$FeynCalcCreationDate gives the date this version of FeynCalc was created."; $FeynCalcVersion::usage= "$FeynCalcVersion is a string that represents the version of FeynCalc."; $FCS::usage="FCS is a list of functions with a short name. E.g. GA[nu] can be used instead of DiracGamma[nu]." ; $FCT::usage="If $FCT is set to True special typesetting rules are applied (FeynCalcTypesetting)."; $FortranContinuationCharacter::usage="$FortranContinuationCharacter is the continuation character used in Write2."; $BreitMaison::usage= "The Breitenlohner-Maison scheme is currently not supported. Use Tracer if you need it."; (* "The setting of $BreitMaison determines whether the Breitenlohner- Maison scheme is applied. If $BreitMaison=True, the so-called naive gamma5 prescription is used, i.e. gamma5 anticommutes in all dimensions. The default is False. The setting should be chosen in the file FeynCalc.m BEFORE loading the package. Reversion during a session is not possible."; *) $Kreimer::usage= "experimental setup of the Kreimer-scheme for Gamma5. Better don't use it."; $Larin::usage= "If set to True, the Larin-Gorishny-Atkyampo-DelBurgo-scheme for gamma5 in D-dimensions is used, i.e., before evaluating traces (but after moving gamma5 anticommuting in all dimensions to the right of the Dirac string) a product gamma[mu].gamma5 is substituted to -I/6 Eps[mu,al,be,si] gamma[al,be,si], where all indices live in D-dimensions now. Especially the Levic-Civita tensor is taken to be D-dimensional, i.e., contraction of two Eps's results in D's. This has (FOR ONE AXIAL-VECTOR-CURRENT ONLY, it is not so clear if this scheme also works for more than one fermion line involving gamma5) the same effect as the Breitenlohner-Maison-'t Hooft-Veltman scheme."; $LimitTo4::usage= "$LimitTo4 is a global variable with default setting True. If set to False no limit Dimension -> 4 is performed after tensor integral decomposition."; $LorentzIndices::usage= "$LorentzIndices is a global variable. If set to True the dimension of LorentzIndex is displayed as an index."; $MemoryAvailable::usage= "$MemoryAvailable is a global variable which is set to an integer n, where n is the available amount of main memory in MB. The default is 128. It should be increased if possible. The higher $MemoryAvailable can be, the more intermediate steps do not have to be repeated by FeynCalc."; $MIntegrate::usage= "$MIntegrate is a global list of integrations done by Mathematica inside OPEIntDelta."; $MomentumIndices::usage= "$MomentumIndices is a global variable. If set to True the dimension of Momentum is displayed as an index."; $NonComm::usage= "$NonComm contains a list of all non-commutative heads present."; $MU::usage= "$MU is the head for dummy indices which may be introduced by Chisholm (and evtl. Contract and DiracReduce)."; $NU::usage= "$NU is the head for dummy indices introduced by OPE2RHI."; $OPEWard::usage= "$OPEWard is experimental."; $PairBrackets::usage = "$PairBrackets determines whether brackets are drawn around " <> "scalar products in the notebook interface."; $SpinorMinimal::usage= "$SpinorMinimal is a global switch for an additional simplification attempt in DiracSimplify for more than one Spinor-line. The default is False, since otherwise it costs too much time."; $VeryVerbose::usage= "$VeryVerbose is a global variable with default setting 0. If set to 1, 2, ..., less and more intermediate comments and informations are displayed during calculations."; $West::usage= "If $West is set to True (which is the default), traces involving more than 4 Dirac matrices and gamma5 are calculated recursively according to formula (A.5) from Comp. Phys. Comm 77 (1993) 286-298, which is based on the Breitenlohner Maison gamma5 - scheme."; $AchmedRoss::usage= "experimental"; $Abbreviations::usage= "$Abbreviations are a list of string substitution rules used when \ generating names for storing intermediate results. \ It is used by OneLoop and PaVeReduce.\ The elements of the list should be of the form \"name\" -> \"abbreviation\"."; $Abbreviations = {", "->"","^"->"","{"->"", "/" -> "", "Subscript"->"su","SmallVariable"->"sma", "}"->"", "["->"", "]"->"", "*" -> "", " " -> "" , "\n" -> "", "\r" -> ""}; TBox::usage="TBox[a, b, ...] produces a RowBox[{a,b, ...}] where a,b, ... are boxed in TraditionalForm."; Tbox::usage="TBox[a, b, ...] produces a RowBox[{a,b, ...}] where a,b, ... are boxed in TraditionalForm."; (* ------------------------------------------------------------------- *) Begin["`Private`"] (* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX *) (* fix several Mma - functions first *) (* Unprotect[Hypergeometric2F1]; Hypergeometric2F1[a___,(n_Times)/;!FreeQ[n,Plus],c___]:= Hypergeometric2F1[a,Expand[n],c]; *) (* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX *) (* $FeynCalc$ = {"$FeynCalc$", "$FeynCalcStuff", "$FeynCalcVersion", "$BreitMaison", "$Kreimer", "$Larin", "$LimitTo4", "$MemoryAvailable", "$MU", "$SpinorMinimal", "$VeryVerbose"}; *) $AchmedRoss = False; $BreitMaison = False; (* SetAttributes[$BreitMaison, Locked];*) $Color = False; $Covariant = False; $FCS = {"FAD", "FV", "FVD", "GA", "GA5", "GS", "GSD", "LC", "LCD", "MT","MTD", "SD", "SOD", "SP", "SPC", "SPD", "SPL", "FCI", "FCE", "FI", "FC", "GGV", "GP", "QGV", "QO" }; $FCT = False; $FortranContinuationCharacter = "&"; If[!ValueQ[$Kreimer], $Kreimer = False]; $Larin = False; $LimitTo4 = True; $LorentzIndices = False; $MemoryAvailable = 256; $MomentumIndices = False; $OPEWard = False; $PairBrackets = False; $MIntegrate = {}; $SpinorMinimal = False; If[!ValueQ[$VeryVerbose], $VeryVerbose = 0]; (* $VeryVerbose = 3; *) $West = True; FI := (Format[LineBreak[_]]:= ""; $PrePrint=InputForm); FC := (Format[LineBreak[_]]:= "\n"; (If[!$Notebooks, $PrePrint= MakeContext["FeynCalcForm"], Unset[$PrePrint]]) ); (* V0 := $VeryVerbose = 0; V3 := $VeryVerbose = 3; *) Li3 = PolyLog[3,#]&; Li2 = PolyLog[2,#]&; (* F21 = Hypergeometric2F1; *) SPC := ToExpression["ScalarProductCancel"]; SPL := ToExpression["SimplifyPolyLog"]; CheckContext[{x__String}] := MemberQ[$Packages, StringJoin@@Flatten[{"HighEnergyPhysics`", Map[SubContext[#] <> # <>"`"&,{x}]}]]; CheckContext[x_String] := MemberQ[$Packages, StringJoin["HighEnergyPhysics`", SubContext[x] <> x, "`"]]; (* nonmulall = {"DiracGamma", "DiracMatrix", "DiracSlash", "ChiralityProjector", "Spinor", "DiracSpinor", "Partial", "QuantumField", "SUNT"}; nonmul = {"DiracGamma", "DiracGammaT", "DiracMatrix", "DiracSlash", "ChargeConjugationMatrix", "ChargeConjugationMatrixInv", "ChiralityProjector", "Spinor", "DiracSpinor", "SUNT" }; *) If[!ValueQ[$NonComm], $NonComm = {}]; (*Unprotect[MakeBoxes];*) Unprotect[ToBoxes]; (* MyNeeds[x_String] := If[!MemberQ[$Packages, x], Needs[x]]; *) MyNeeds[x_String] := ( If[!MemberQ[$Packages, x], Needs[x]]); Load[x_Symbol] := Get["HighEnergyPhysics`FeynCalc`" <> ToString[x] <> "`"]; (* This is for the grouping of files in subdirectories in HighEnergyPhysics, like: general, fctools, fctables, qcd *) SubContext[_String] := "FeynCalc`"; MakeContext[x_String, y_String] := If[SubContext[x] === "FeynCalc`", ToExpression["HighEnergyPhysics`FeynCalc`"<> x <>"`" <> y], (MyNeeds["HighEnergyPhysics`"<> SubContext[x] <> x <>"`"]; ToExpression["HighEnergyPhysics`"<>SubContext[x]<>x<>"`"<>y] (*<>x<>"`" added 6/8-2000, F.Orellana*) )]; SetAttributes[MakeContext, HoldAll]; SetAttributes[SetDel, HoldAll]; SetDel[a_, b_] := (a := a = b); MakeContext[x_Symbol] := MakeContext[x] = With[{s=ToString[x]}, SetDel[x, Apply[MakeContext, {s}]]]; MakeContext[x___Symbol] := Map[MakeContext, {x}]; MakeContext[x_String] := MakeContext[x] = (If[SubContext[x] =!= "FeynCalc`", MyNeeds["HighEnergyPhysics`"<> SubContext[x] <> x <>"`"]]; ToExpression["HighEnergyPhysics`"<>SubContext[x] <> x <> "`" <> x]); fcnames = Names["HighEnergyPhysics`FeynCalc`*"]; DPS[x__] := DPS[x] = DeclarePackage[x]; fcDeclarePackge[{x_, y_List}] := fcDeclarePackge[x, y]; fcDeclarePackge[{x_, y_ /;(Head[y]=!=List),z___}] := fcDeclarePackge[x, {Last[Flatten[{x}]], y, z}]; fcDeclarePackge[x_, y_] := (*If[MemberQ[$Packages, "HighEnergyPhysics`FeynArts`"], If[!MemberQ[fcnames, x] && (!CheckContext[x](* && FreeQ[multifunpack, x]*)), DPS[StringJoin["HighEnergyPhysics`", SubContext[x], x], y]; ],*) If[!CheckContext[x] (*&& FreeQ[multifunpack, x]*), DPS[StringJoin["HighEnergyPhysics`", SubContext[x], x, "`"], y] ]; (* ];*) fcDeclarePackge[x_String] := fcDeclarePackge[x, x]; DeclarePackage["HighEnergyPhysics`fctools`OneLoop`",{"OneLoopSum"}]; multifunpack= { {"Contract","Contract2", "Contract3"}, {"DiracSlash", "SL"}, {"DiracSimplify", "ChisholmSpinor"}, (* {"FermionSpinSum", "SpinorCollect"}, *) {"FeynAmpDenominatorSimplify", "FDS"}, {"FeynCalcForm", "FCF"}, {"FeynCalcInternal", "FCI"}, {"FeynCalcExternal", "FCE"}, {"GluonGhostVertex", "GGV"}, {"Twist2GluonOperator", "GO"}, {"GluonPropagator", "GP"}, {"GhostPropagator", "GHP"}, {"GluonVertex", "GV"}, {"QuarkGluonVertex", "QGV"}, {"QuarkPropagator", "QP"}, {"Twist2QuarkOperator", "QO"}, {"FeynAmpDenominator", "FD"}, {"PropagatorDenominator", "PD"}, (* {"PropagatorDenominatorSign", "PDS"}, *) {"Write2", "FUNCTION", "PostFortranFile", "PreFortranFile"} }; feyncalcdir = HighEnergyPhysics`FeynCalc`$FeynCalcDirectory; SetDirectory[feyncalcdir]; (* get all the directories (like general, qcd, fctools, fctables *) hepdirs = Select[FileNames[], FileType[#]===Directory&]; (* fix for Mac OS *) If[StringMatchQ[$OperatingSystem, "*MacOS*"], hepdirs = If[StringMatchQ[#, ":*"], StringDrop[#, 1], #] & /@ hepdirs]; hepdirs = Complement[ hepdirs, HighEnergyPhysics`FeynCalc`$ExcludeAutomaticDeclarePackageDirectories]; declarepackagelist ={}; Do[ SetDirectory[hesubdir = hepdirs[[i]]]; fils = FileNames[{"*.m", "*.mx"}]; If[fils =!= {}, dotmfiles = StringReplace[fils, {".m" -> "",".mx"->"", $PathnameSeparator->""} ]; (Hold[Set][Hold[SubContext][#], hesubdir <> "`"]& /@ dotmfiles) // ReleaseHold; filenams = Select[dotmfiles, FreeQ[multifunpack, #]&]; declarepackagelist = Join[declarepackagelist, filenams]; ]; ResetDirectory[], {i, Length[hepdirs]} ]; declarepackagelist = Join[declarepackagelist, multifunpack]; (* filenams= StringReplace[FileNames[{"*.m","*.mx"}], {".m" -> "",".mx"->"", $PathnameSeparator->""} ]; *) ResetDirectory[]; declarepackagelist = Join[declarepackagelist, multifunpack]; $FeynCalcStuff = Union[Flatten[declarepackagelist]]; TBox[] = "\[Null]"; TBox[a_] := ToBoxes[a, TraditionalForm]; Tbox[] = "\[Null]"; Tbox[a_] := totr[a]; TBox[a_,b__] := RowBox @ Map[(ToBoxes @@ {#, TraditionalForm})&, {a, b}]; (* totr[y_Symbol] := If[MemberQ[$FeynCalcStuff, ToString[y]], ToBoxes[y, TraditionalForm], y]; *) totr[Subscript[y_,in__Integer]] := SubscriptBox[totr[y],RowBox[{in}]]; totr[y_Symbol] := If[FormatValues[Evaluate[y]] === {}, ToString[y], ToBoxes[y, TraditionalForm], y]; totr[y_String] := y; totr[y_] := ToBoxes[y, TraditionalForm] /; Head[y]=!=Symbol; (* Tbox[a__] := RowBox @@ {Map[totr, {a}]}; *) (* Unprotect[Insert]; SetAttributes[Insert, SequenceHold]; *) (* somehow \[NoBreak] does not really work, but it does the spacing "right" ...*) (* Tbox[a__] := RowBox @@ {Map[totr, {a}]}; *) Tbox[a_,b__] := (RowBox @ (Insert[ Map[totr, {a,b}], "\[NoBreak]", Array[{#}&,Length[{a,b}]-1,2]])); (* Tbox[a__] := (RowBox @ (Insert[ Map[ToBoxes [#, TraditionalForm]&, {a}], Global`UNNoBreak, Array[{#}&,Length[{a}]-1,2]])); *) (* (* a la Robby *) SetAttributes[Tbox, HoldAllComplete]; Tbox[a_] := MakeBoxes[a, TraditionalForm]; Tbox[a_, b__] := RowBox @ Map[Function[expr, MakeBoxes[expr, TraditionalForm], HoldAllComplete], Unevaluated[{a, b}] ] Tbox[a_, b__] := RowBox @ Thread @ Unevaluated[MakeBoxes[{a, b}, TraditionalForm ]] *) Unprotect[Dot]; Dot /: MakeBoxes[Dot[a__], TraditionalForm] := ( ClearAttributes[Times, Orderless]; embo = MakeBoxes[Times[a], TraditionalForm]; SetAttributes[Times, Orderless]; embo ) /; $FCT === True; (* Unprotect[Times]; Times/: MakeBoxes[HoldPattern[Times[factors___]] /; MemberQ[Unevaluated[{factors}], _Dot], TraditionalForm ] := Replace[ Flatten[#, Infinity, Times]& @ (Flatten[#, Infinity, Dot]&) @ HoldComplete[factors], HoldComplete[operands___] :> (InterpretationBox[#, Times[factors]]& @ MakeBoxes[Times[operands], TraditionalForm]) ] /; $FCT === True; *) End[]; MyEndPackage[]; Map[HighEnergyPhysics`FeynCalc`Private`fcDeclarePackge, HighEnergyPhysics`FeynCalc`Private`declarepackagelist]; (* take care of SubContext of the multifunpack values *) tab = ( Table[ Map[ setsubcontext[#, HighEnergyPhysics`FeynCalc`Private`multifunpack[[i,1]] ]&, Rest[ HighEnergyPhysics`FeynCalc`Private`multifunpack[[i]] ] ], {i, Length[HighEnergyPhysics`FeynCalc`Private`multifunpack]} ] /. setsubcontext[a_String,b_String] :> {Hold[Set][Hold[SubContext][a], Hold[SubContext][b]], Hold[Set][Hold[MakeContext][a], Hold[MakeContext][b]]} ) ; (* Global`TT=tab; *) ReleaseHold[tab]; (*If[HomeDirectory[] === "/home/rolfm", Print["declaring done ",TimeUsed[]]];*) (* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX *) (* ------------------------------------------------------------------- *) If[Global`$FeynCalcStartupMessages =!= False , If[$Notebooks===True, CellPrint[Cell[TextData[{StyleBox[ "FeynCalc" , FontWeight-> "Bold"], " ", $FeynCalcVersion, " For help, type ?FeynCalc, ", ButtonBox["use the built-in help system", ButtonFunction -> (FrontEndExecute[FrontEnd`HelpBrowserLookup["AddOns", #]] &), ButtonData:>{ "Short Overview", "intro"}, ButtonStyle->"AddOnsLink", ButtonNote->"Open the help browser"], " or visit ", ButtonBox["www.feyncalc.org", ButtonData:>{ URL[ "http://www.feyncalc.org"], None}, ButtonStyle->"Hyperlink", ButtonNote->"http://www.feyncalc.org"]} ],"Text"]] , WriteString["stdout", "\nFeynCalc" <> $FeynCalcVersion , " Type ?FeynCalc for help or visit http://www.feyncalc.org", "\n"]; ]; ]; (* RM change for webMathematica compatability*) If[MemberQ[$Packages, "MSP`"], feversion ="web", If[$Notebooks===True && (!StringMatchQ[$Version, "*1996*"]), feversion = (LinkWriteHeld[$ParentLink,Hold[FrontEnd`Value[ FrontEnd`$FullVersion]]]; LinkRead[$ParentLink]), feversion="Failed" ]; ]; If[!StringMatchQ[$Version, "*1996*"] && (!StringMatchQ[feversion,"*3.0.0*"]) && ($Notebooks === True), SetOptions[$FrontEnd, "CommonDefaultFormatTypes"->{"Output" -> TraditionalForm}] , Null (* If[($Notebooks === True) && (Global`$FeynCalcStartupMessages =!= False), If[(("Output" /. ( Flatten[ {Options[$FrontEnd, "CommonDefaultFormatTypes"]} ][[1,2]] ) ) ) =!= TraditionalForm , CellPrint[ Cell[TextData[{ "Please click on the ", StyleBox["Cell", FontWeight->"Bold"], " menu, then go to the ", StyleBox["Default Output Format Type ", FontWeight->"Bold"], "item and switch to ", StyleBox["TraditionalForm", FontWeight->"Bold"], "." }], "Text"] ]] ]; *) ]; Clear[feversion]; (* Times/:MakeBoxes[Times[x__],TraditionalForm] := ( MakeBoxes[Times2[x],TraditionalForm]/; ((!FreeQ[{x},Dot] )&&(Length[{x}]<6)) && (HighEnergyPhysics`FeynCalc`$FCT === True) && (* one factor at least has to have Head Dot *) MemberQ[Head/@{x}, Dot] ); Times2/: MakeBoxes[Times2[before___, dot_Dot, after___], TraditionalForm] := Replace[ Flatten[#, Infinity, Times]& @ (Flatten[#, Infinity, Dot]&) @ HoldComplete[ before, dot, after], HoldComplete[operands___] :> Apply[InterpretationBox,{ MakeBoxes[Times[operands], TraditionalForm], Times[before, dot, after]}] ] ; *) (* Unprotect[ Equal]; Format[ HoldPattern[Equal][ x___], TraditionalForm] := Infix[ Equal[x], " = "] /; HighEnergyPhysics`FeynCalc`$FCT === True; *) (* special case *) (* MakeBoxes[Log[x_], TraditionalForm] := Tbox["\[ScriptL]","n","(",x,")"] /; HighEnergyPhysics`FeynCalc`$FCT === True; *) (* MakeBoxes[Log[x_], TraditionalForm] := MakeBoxes[ln[x],TraditionalForm] /; HighEnergyPhysics`FeynCalc`$FCT === True; *) (* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX *) (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: A *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: created 4 March '97 at 14:34 *) (* ------------------------------------------------------------------------ *) (* :Summary: Gauge field *) (* ------------------------------------------------------------------------ *) (* MyBeginPackage["HighEnergyPhysics`FeynCalc`A`", "HighEnergyPhysics`FeynCalc`"]; A::usage = "A is the name of a gauge field. The default setting of FieldStrength for QuantumField is A."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "A | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) *) (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: A0ToB0 *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: created 4 March '97 at 14:34 *) (* ------------------------------------------------------------------------ *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`A0ToB0`", "HighEnergyPhysics`FeynCalc`"]; A0ToB0::usage = "A0ToB0 is an option for A0. If set to True, A0[m^2] is expressed by (1+ B0[0,m^2,m^2])*m^2."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "A0ToB0 | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: Abbreviation *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: created 4 March '97 at 14:34 *) (* ------------------------------------------------------------------------ *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`Abbreviation`", "HighEnergyPhysics`FeynCalc`"]; Abbreviation::usage= "Abbreviation[name] gives a shortname for name (in HoldForm). E.g.: Abbreviation[QuarkPropagator] --> HoldForm[QP]."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "Abbreviation | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: Anti5 *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: File created on 22 June '97 at 22:58 *) (* ------------------------------------------------------------------------ *) (* :Summary: Anti5 is the head of Levi-Civita Tensor *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`Anti5`", "HighEnergyPhysics`FeynCalc`"]; Anti5::usage = "Anti5[exp] anticommutes all gamma5 one time to the right. Anti5[exp, n] anticommutes all gamma5 n times to the right. Anti5[exp, -n] anticommutes all gamma5 n times to the left."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; MakeContext[DiracGamma, DOT, FeynCalcInternal, MemSet]; Anti5[a_/;FreeQ[a, DiracGamma[5]],_] := a; Anti5[x_, Infinity] := FixedPoint[Anti5, x, $RecursionLimit]; Anti5[xx_,n_Integer?Positive] := Nest[Anti5, xx, n]; Anti5[xx_] := (FeynCalcInternal[xx] /. DOT -> doot) /. If[$BreitMaison =!= True, {doot[a___, DiracGamma[5], DiracGamma[y_[x__], di___], b___] :> (-doot[a,DiracGamma[y[x],di],DiracGamma[5],b]) }, {doot[a___, DiracGamma[5], DiracGamma[y_[x_]], b___] :> (-doot[a,DiracGamma[y[x]],DiracGamma[5],b]) , doot[a___, DiracGamma[5], DiracGamma[y_[x_,di_Symbol], di_Symbol ], b___ ] :> (-doot[a,DiracGamma[y[x], di], DiracGamma[5], b] + 2 doot[a,DiracGamma[y[x,di-4],di-4],DiracGamma[5],b] ) } ] /.doot[a___, DiracGamma[5], DiracGamma[5],b___ ] :> doot[a,b] /. doot -> DOT; Anti5[xx_,-1] := (FeynCalcInternal[xx] /. DOT -> doot) /. {doot[a___, DiracGamma[y_[x__], di___], DiracGamma[5], b___] :> (-doot[a, DiracGamma[5], DiracGamma[y[x],di], b]) } /. doot -> DOT (* Anti5[xx_] := MemSet[Anti5[xx], (FeynCalcInternal[xx] /. DOT -> doot) /. {doot[a___, DiracGamma[5], DiracGamma[y_[x__], di___], b___] :> (-doot[a,DiracGamma[y[x],di],DiracGamma[5],b]) } /. doot -> DOT]; Anti5[xx_,-1] := MemSet[Anti5[xx,-1], (FeynCalcInternal[xx] /. DOT -> doot) /. {doot[a___, DiracGamma[y_[x__], di___], DiracGamma[5], b___] :> (-doot[a, DiracGamma[5], DiracGamma[y[x],di], b]) } /. doot -> DOT]; *) Anti5[xx_,n_Integer?Negative] := Nest[Anti5[#,-1]&, xx, -n] /; n <(-1); Anti5[x_, -Infinity] := Anti5[x, -$RecursionLimit]; Anti5[x_, -Infinity] := FixedPoint[Anti5[#,-1]&, x, $RecursionLimit]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "Anti5 | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: AntiCommutator *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: File created on 22 June '97 at 22:58 *) (* ------------------------------------------------------------------------ *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`AntiCommutator`", "HighEnergyPhysics`FeynCalc`"]; AntiCommutator::usage= "AntiCommutator[x, y] = c defines the anti-commutator of the non-commuting objects x and y. Settings of AntiCommutator (e.g.AntiCommutator[a,b]=c) are recognized by DotSimplify."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; MakeContext[DataType, NonCommutative]; AntiCommutator /: Set[AntiCommutator[a_, b_] , c_] := Block[{nd, acom}, nd = (RuleDelayed @@ {HoldPattern @@ {acom[a, b]}, c} ) /. acom -> AntiCommutator ; If[FreeQ[DownValues[AntiCommutator], nd], PrependTo[DownValues[AntiCommutator], nd] ]; c]; AntiCommutator /: MakeBoxes[ AntiCommutator[a_, b_], TraditionalForm ] := Tbox["{", a, ",", "\[MediumSpace]", b, "}"]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "AntiCommutator | \n "]]; Null (* :Title: AntiQuarkField *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: created 4 March '97 at 14:34 *) (* ------------------------------------------------------------------------ *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`AntiQuarkField`", "HighEnergyPhysics`FeynCalc`"]; AntiQuarkField::usage = "AntiQuarkField is the name of a fermionic field."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; AntiQuarkField /: MakeBoxes[AntiQuarkField, TraditionalForm] := OverscriptBox["\[Psi]","_"]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "AntiQuarkField | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: Bracket *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: created 4 March '97 at 14:34 *) (* ------------------------------------------------------------------------ *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`Bracket`", "HighEnergyPhysics`FeynCalc`"]; Bracket::usage= "Bracket is an option for Convolute."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "Bracket | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: CA *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: created 4 March '97 at 14:34 *) (* ------------------------------------------------------------------------ *) (* :Summary: CA = the N of SU(N) *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`CA`", "HighEnergyPhysics`FeynCalc`"]; CA::usage= "CA is one of the Casimir operators of SU(N); CA = N"; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; CA /: MakeBoxes[ CA, TraditionalForm ] := SubscriptBox["C", "A"]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "CA | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: CF *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: created 4 March '97 at 14:34 *) (* ------------------------------------------------------------------------ *) (* :Summary: CF *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`CF`", "HighEnergyPhysics`FeynCalc`"]; CF::usage= "CF is one of the Casimir operators of SU(N); CF = (N^2-1)/(2 N)"; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; CF /: MakeBoxes[ CF, TraditionalForm ] := SubscriptBox["C", "F"]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "CF | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: Cases2 *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: created 4 March '97 at 14:34 *) (* ------------------------------------------------------------------------ *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`Cases2`", "HighEnergyPhysics`FeynCalc`"]; Cases2::usage= "Cases2[expr, f] is equivalent to Cases[{expr}, HoldPattern[f[___]], Infinity]//Union. Cases2[expr, f1, f2, ...] or Cases2[expr, {f1, f2, ...}] is equivalent to Cases[{expr}, f1[___] | f2[___] ..., Infinity]//Union."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; Options[Cases2] = {Heads -> False}; Cases2[expr_, {f___}, opts___Rule] := Cases2 @@ Prepend[{f,opts}, expr]; If[$VersionNumber >2.2, Cases2[expr_, f_, opts___Rule] := Union[Cases[{expr}, HoldPattern[f[___]], Infinity,opts]] , Cases2[expr_, f_,opts___Rule] := Union[Cases[{expr}, HoldPattern[f[___]], Infinity,opts]] ]; Cases2[expr_, f___, g_] := Union[Cases[{expr}, Alternatives@@(#[___]&/@{f,g}),Infinity] ] /; Head[g] =!= Rule; Cases2[expr_, f__, Heads->True] := Union[Cases[{expr}, Alternatives@@(#[___]&/@{f,g}),Infinity,Heads->True]]; Cases2[expr_, f__, Heads->False] := Union[Cases[{expr}, Alternatives@@(#[___]&/@{f,g}),Infinity,Heads->False]]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "Cases2 | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: Collecting *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: created 4 March '97 at 14:34 *) (* ------------------------------------------------------------------------ *) (* :Summary: Collecting *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`Collecting`", "HighEnergyPhysics`FeynCalc`"]; Collecting::usage = "Collecting is an option of Contract2, ScalarProductCancel, SquareAmplitude, Series2, TID and related functions. Setting it to True will trigger some kind of collecting of the result."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "Collecting | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: Commutator *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: File created on 22 June '97 at 22:58 *) (* ------------------------------------------------------------------------ *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`Commutator`", "HighEnergyPhysics`FeynCalc`"]; Commutator::usage= "Commutator[x, y] = c defines the commutator between the non-commuting objects x and y."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; MakeContext[DataType, NonCommutative]; Commutator /: Set[Commutator[a_, b_] , c_] := Block[{nd, com}, nd = (RuleDelayed @@ {HoldPattern @@ {com[a, b]}, c} ) /. com -> Commutator ; If[FreeQ[DownValues[Commutator], nd], PrependTo[DownValues[Commutator], nd] ]; c]; Commutator/: MakeBoxes[Commutator[a_, b_], TraditionalForm ] := RowBox[ {"[","\[NoBreak]", Tbox[a] ,"\[NoBreak]", ",", Tbox[b], "\[NoBreak]", "]"}]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "Commutator | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: CommutatorExplicit *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: File created on 22 June '97 at 22:58 *) (* ------------------------------------------------------------------------ *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`CommutatorExplicit`", "HighEnergyPhysics`FeynCalc`"]; CommutatorExplicit::usage= "CommutatorExplicit[exp] substitutes any Commutator and AntiCommutator in exp by their definitions."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; MakeContext[ AntiCommutator, Commutator, DOT ]; CommutatorExplicit[exp_] := exp /. {Commutator :> ((DOT[#1, #2] - DOT[#2, #1])&), AntiCommutator :> ((DOT[#1, #2] + DOT[#2, #1])&) }; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "CommutatorExplicit | \n "]]; Null (* :Title: ComplexIndex *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: created 4 March '97 at 14:34 *) (* ------------------------------------------------------------------------ *) (* :Summary: The head for complex conjugated indices *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`ComplexIndex`", "HighEnergyPhysics`FeynCalc`"]; ComplexIndex::usage= "ComplexIndex is the head of a complex conjugate index."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; ComplexIndex[ComplexIndex[x_]] := x; ComplexIndex /: MakeBoxes[ComplexIndex[x_] ,TraditionalForm] := SuperscriptBox[Tbox[x], "*"]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "ComplexIndex | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: CounterT*) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: File created on 22 June '97 at 22:58 *) (* ------------------------------------------------------------------------ *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`CounterT`", "HighEnergyPhysics`FeynCalc`"]; CounterT::usage= "CounterT is an option for several Feynman rule functions."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "CounterT | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: CouplingConstant *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: created 4 March '97 at 14:34 *) (* ------------------------------------------------------------------------ *) (* :Summary: CouplingConstant *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`CouplingConstant`", "HighEnergyPhysics`FeynCalc`"]; CouplingConstant::usage = "CouplingConstant is an option for several Feynman rule functions and for CovariantD and FieldStrength."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "CouplingConstant | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: DOT *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: created 4 March '97 at 14:34 *) (* ------------------------------------------------------------------------ *) (* :Summary: DOT *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`DOT`", "HighEnergyPhysics`FeynCalc`"]; DOT::usage = "DOT[a, b, ...] is the FeynCalc function for non-commutative multiplication. By default it is set to the Mathematica Dot functions. By setting \n (DOT=.) \n this can be disabled. Note that then non-commutative products should to be entered like DOT[ DiracMatrix[mu], m + DiracSlash[p], DiracMatrix[mu] ], etc."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; DOT = Dot; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "DOT | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: DataType *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: File created on 22 June '97 at 22:58 *) (* ------------------------------------------------------------------------ *) (* :Summary: DataType is just a datatype *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`DataType`", "HighEnergyPhysics`FeynCalc`"]; DataType::usage= "DataType[exp, type] = True defines the object exp to have datatype type. DataType[exp1, exp2, ..., type] defines the objects exp1, exp2, ... to have datatype type. The default setting is DataType[__, _]:=False. To assign a certain data type, do e.g.: DataType[x, PositiveInteger] = True."; (* ------------------------------------------------------------------------ *) Begin["`Private`"] MakeContext[NonCommFreeQ, SelectFree]; noncommutative := noncommutative = MakeContext["NonCommutative"]; DataType[_] := soso /; Message[DataType::argrx, DataType, 1, "2 or more"]; DataType[] := soso /; Message[DataType::argrx, DataType, 0, "2 or more"]; DataType /: HoldPattern[Set[DataType[a_, b__,type_], bool_]] := Map[set[dt[#, type], bool]&, {a, b}] /. {set:>Set,dt:>DataType}; DataType[a_, b__, type_] := Flatten[{DataType[a, type], DataType[b, type]}]; (* special rules for NonCommutative *) DataType /: HoldPattern[Set[DataType[exp_, HighEnergyPhysics`FeynCalc`NonCommutative`NonCommutative], True]] := Block[{ndt, ndf, dt, ncq, nnn, nnt, set, downvalues}, If[!MemberQ[$NonComm, exp], AppendTo[$NonComm, exp]]; ndt = (RuleDelayed @@ {HoldPattern @@ {dt[exp, noncommutative]}, True} ) /. dt -> DataType; ndf = (RuleDelayed @@ {HoldPattern @@ {dt[exp, noncommutative]}, False} ) /. dt -> DataType; If[FreeQ[DownValues[DataType], ndt], DownValues[DataType] = Prepend[SelectFree[DownValues[DataType], ndf], ndt] ]; nnt = (RuleDelayed @@ {HoldPattern @@ {ncq[exp]}, False} ) /. ncq -> NonCommFreeQ; set[downvalues[NonCommFreeQ],Prepend[ SelectFree[DownValues@@{NonCommFreeQ}, exp], nnt ] ] /. {set :> Set, downvalues :> DownValues}; True]; DataType /: HoldPattern[Set[DataType[exp_, HighEnergyPhysics`FeynCalc`NonCommutative`NonCommutative], False]] := Block[{ndt, ndf, dt, ncq, nnn, nnt, set, downvalues}, If[MemberQ[$NonComm, exp], $NonComm = SelectFree[$NonComm, exp]; ]; ndt = (RuleDelayed @@ {HoldPattern @@ {dt[exp, noncommutative]}, True} ) /. dt -> DataType; ndf = (RuleDelayed @@ {HoldPattern @@ {dt[exp, noncommutative]}, False} ) /. dt -> DataType; If[FreeQ[DownValues[DataType], ndf], DownValues[DataType] = Prepend[SelectFree[DownValues[DataType], ndt], ndf] ]; nnn = (RuleDelayed @@ {HoldPattern @@ {ncq[exp]}, _} ) /. ncq -> NonCommFreeQ; If[!FreeQ[DownValues[NonCommFreeQ], nnn], DownValues[NonCommFreeQ] = SelectFree[DownValues[NonCommFreeQ], nnn] ]; nnt = (RuleDelayed @@ {HoldPattern @@ {ncq[exp]}, True} ) /. ncq -> NonCommFreeQ; set[downvalues[NonCommFreeQ],Prepend[ SelectFree[DownValues@@{NonCommFreeQ}, exp], nnt ] ] /. {set :> Set, downvalues :> DownValues}; False]; HoldPattern[DataType[__, _]] := False; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "DataType | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: DeclareNonCommutative *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: File created on 22 June '97 at 22:58 *) (* ------------------------------------------------------------------------ *) (* :Summary: test for non-commutativity *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`DeclareNonCommutative`", "HighEnergyPhysics`FeynCalc`"]; DeclareNonCommutative::usage = "DeclareNonCommutative[a, b, ...] declares a,b, ... to be noncommutative, i.e., DataType[a,b, ..., NonCommutative] is set to True."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; (* DataType = MakeContext["DataType"]; NonCommutative = MakeContext["NonCommutative"]; *) DeclareNonCommutative[] := soso /; Message[DeclareNonCommutative::argrx, DeclareNonCommutative, 0, "1 or more"]; DeclareNonCommutative[b__] := (Map[Set[HighEnergyPhysics`FeynCalc`DataType`DataType[#, HighEnergyPhysics`FeynCalc`NonCommutative`NonCommutative], True]&, {b} ]; Null); End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "DeclareNonCommutative | \n "]]; Null (* :Title: DeltaFunction *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: created 4 March '97 at 14:34 *) (* ------------------------------------------------------------------------ *) (* :Summary: Dirac-delta function (just a name) *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`DeltaFunction`", "HighEnergyPhysics`FeynCalc`"]; DeltaFunction::usage= "DeltaFunction is the Dirac delta-function."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; (*Added 18 April 2001, Frederik Orellana*) DeltaFunction[_?((NumericQ[#]===True&&(Positive[#]===True||Negative[#]===True))&)]:=0; DeltaFunction[0]:=1; DeltaFunction /: MakeBoxes[ DeltaFunction[y_], TraditionalForm] := RowBox[{"\[Delta]", "(", Tbox[y], ")"}]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "DeltaFunction | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: DeltaFunctionPrime*) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: File created on 22 June '97 at 22:58 *) (* ------------------------------------------------------------------------ *) (* :Summary: Dirac-delta function derivative (just a name) *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`DeltaFunctionPrime`", "HighEnergyPhysics`FeynCalc`"]; DeltaFunctionPrime::usage= "DeltaFunctionPrime denotes the derivative of the Dirac delta-function."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; DeltaFunctionPrime /: MakeBoxes[ DeltaFunctionPrime[y_], TraditionalForm] := RowBox[{SuperscriptBox["\[Delta]","\[Prime]"], "(", Tbox[y], ")"} ]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "DeltaFunctionPrime | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: DeltaFunctionDoublePrime*) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: File created on 10 July '98 at 12:05 *) (* ------------------------------------------------------------------------ *) (* :Summary: Dirac-delta function double derivative (just a name) *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`DeltaFunctionDoublePrime`", "HighEnergyPhysics`FeynCalc`"]; DeltaFunctionDoublePrime::usage= "DeltaFunctionDoublePrime denotes the second derivative of the Dirac delta-function."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; DeltaFunctionDoublePrime /: MakeBoxes[ DeltaFunctionDoublePrime[y_], TraditionalForm] := RowBox[{SuperscriptBox["\[Delta]","\[DoublePrime]"], "(", Tbox[y], ")"} ]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "DeltaFunctionDoublePrime | \n "]]; Null (* :Title: Dimension *) (* :Author: Rolf Mertig *) (* :Summary: Dimension is an option for several functions *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`Dimension`", "HighEnergyPhysics`FeynCalc`"]; Dimension::usage = "Dimension is an option for DiracMatrix, DiracSlash, FourVector, LeviCivita, MetricTensor, OneLoop and ScalarProduct. The default setting is sometimes 4, sometimes D. The setting should always be 4, a symbol (D, n, ...), or (D-4), (n-4), ... ."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: DimensionalReduction *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: created 4 March '97 at 14:34 *) (* ------------------------------------------------------------------------ *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`DimensionalReduction`", "HighEnergyPhysics`FeynCalc`"]; DimensionalReduction::usage= "DimensionalReduction is an option for TID and OneLoopSimplify."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "DimensionalReduction | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: DiracBasis *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: created 4 March '97 at 14:34 *) (* ------------------------------------------------------------------------ *) (* :Summary: DiracBasis is just a auxiliary head for Dirac structures *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`DiracBasis`", "HighEnergyPhysics`FeynCalc`"]; DiracBasis::usage = "DiracBasis[any] is a head which is wrapped around Dirac structures (and the 1) as a result of the function DiracReduce. Eventually you want to substitute DiracBasis by Identity (or set: DiracBasis[1] = S; DiracBasis[DiracMatrix[mu]] = P; etc.)."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "DiracBasis | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: DiracCanonical *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: created 4 March '97 at 14:34 *) (* ------------------------------------------------------------------------ *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`DiracCanonical`", "HighEnergyPhysics`FeynCalc`"]; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; DiracCanonical::usage= "DiracCanonical is an option for DiracSimplify. If set to True DiracSimplify uses the function DiracOrder internally."; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "DiracCanonical | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: DiracEquation *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :Summary: Dirac equation application; not fully *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`DiracEquation`", "HighEnergyPhysics`FeynCalc`"]; DiracEquation::usage= "DiracEquation[exp] applies the Dirac equation without expanding exp. If that is needed, use DiracSimplify."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; MakeContext[ DiracGamma, FreeQ2, LorentzIndex, Momentum, Spinor, Pair, PairContract]; dot := dot = MakeContext["DOT"]; diractrick := diractrick = MakeContext["DiracTrick"]; dotsimplify:=dotsimplify = MakeContext["DotSimplify"]; expanding:=expanding = MakeContext["Expanding"]; fci := fci = MakeContext["FeynCalcInternal"]; DiracEquation[x_]:=(*DiracEquation[x]=*) dotsimplify[diraceq[x//fci], expanding -> False]; (* for only internal use *) DiracEquation[x_,I]:=(*DiracEquation[x]=*) dotsimplify[diraceq[x], expanding -> False]; last[n_. Momentum[pe__]]:=Momentum[pe]; last[x_Plus]:=PowerExpand[Sqrt[Last[x]^2]]; diraceq[x_]:=x/;FreeQ[x,Spinor]; diraceq[x_] := Expand[ x//.spCDieqRules, dot ]; spCDieqRules = { doot_[ z___,Spinor[n_. Momentum[p_] + k_. ,m_, op___], DiracGamma[Momentum[p_,___],___],a___ ] :>(m/n doot[ z,Spinor[n Momentum[p] + k,m,op ],a ] - If[(k===0), 0 , If[last[n Momentum[p] + k] =!= Momentum[p],0, 1/n doot[ z, Spinor[n Momentum[p] + k,m,op ], DiracGamma[k], a ] ] ] )/; last[n Momentum[p]+k]===Momentum[p], doot_[ a___,DiracGamma[Momentum[p_,___],___], Spinor[n_. Momentum[p_] + k_. ,m_,op___],z___ ] :>(m/n doot[ a,Spinor[ n Momentum[p] + k,m,op ],z ] - If[(k===0), 0 , If[last[n Momentum[p] + k] =!= Momentum[p],0, 1/n doot[ a, DiracGamma[k], Spinor[n Momentum[p] + k,m,op ], z ] ] ] ) /; last[n Momentum[p]+k]===Momentum[p], doot_[ a___,DiracGamma[Momentum[y__],___], DiracGamma[Momentum[y__],___],b___ ] :> scev[Momentum[y],Momentum[y]] doot[a,b], doot_[ z___,Spinor[n_. Momentum[p_] + k_. ,m_,op___],a___, DiracGamma[x_[y__],di___], DiracGamma[Momentum[p_,dim___],dim___],b___ ] :> If[!FreeQ2[{a}, {DiracGamma[5], DiracGamma[6], DiracGamma[7]}], diractrick[Dot[z,Spinor[n Momentum[p]+k,m,op], a, Diracgamma[x[y],di], DiracGamma[Momentum[p,dim],dim],b ] ] /. Dot -> doot, ( - doot[ z,Spinor[n Momentum[p]+k,m,op ],a, DiracGamma[Momentum[p,dim],dim], DiracGamma[x[y],di],b ] + 2 (( PairContract[x[y],Momentum[p,dim] ] * doot[ z,Spinor[n Momentum[p]+k,m,op],a,b ] ) /. PairContract -> Pair) ) ] /; last[n Momentum[p]+k] === Momentum[p], doot_[ a___,DiracGamma[Momentum[p_,___],___],DiracGamma[5], Spinor[n_. Momentum[p_] + k_. ,m_,op___],z___ ] :> (-m/n doot[a,DiracGamma[5],Spinor[n Momentum[p]+k,m,op],z ]- If[k===0, 0, If[last[n Momentum[p] + k] =!= Momentum[p],0, 1/n doot[ a, DiracGamma[k], DiracGamma[5], Spinor[n Momentum[p] + k,m,op ], z] ] ] ) /; last[n Momentum[p]+k]===Momentum[p], doot_[ a___,DiracGamma[Momentum[p_,___],___],DiracGamma[6], Spinor[n_. Momentum[p_] + k_. ,m_,op___],z___ ] :> (m/n doot[a,DiracGamma[7],Spinor[n Momentum[p]+k,m,op],z ]- If[k===0, 0, If[last[n Momentum[p] + k] =!= Momentum[p],0, 1/n doot[ a, DiracGamma[k], DiracGamma[6], Spinor[n Momentum[p] + k,m,op ], z] ] ] ) /; last[n Momentum[p]+k]===Momentum[p], doot_[ a___,DiracGamma[Momentum[p_,___],___],DiracGamma[7], Spinor[n_. Momentum[p_] + k_. ,m_,op___],z___ ] :> (m/n doot[a,DiracGamma[6],Spinor[n Momentum[p]+k,m,op],z ]- If[k===0, 0, If[last[n Momentum[p] + k] =!= Momentum[p],0, 1/n doot[ a, DiracGamma[k], DiracGamma[7], Spinor[n Momentum[p] + k,m,op ], z] ] ] ) /; last[n Momentum[p]+k]===Momentum[p], doot_[ a___,DiracGamma[ Momentum[p_,dim___],dim___], DiracGamma[x_[y__],di___],b___, Spinor[n_. Momentum[p_] + k_. ,m_,op___],z___ ] :> (- doot[ a,DiracGamma[x[y],di], DiracGamma[Momentum[p,dim],dim],b, Spinor[n Momentum[p] + k,m,op ],z ] + 2 (( PairContract[x[y],Momentum[p,dim]] * doot[ a,b,Spinor[n Momentum[p] +k,m,op],z ] )/. PairContract -> Pair) ) /; last[n Momentum[p]+k]===Momentum[p] }; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "DiracEquation | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: DiracGamma *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: File created on 7 December '98 at 21:05 *) (* ------------------------------------------------------------------------ *) (* :Summary: internal head of dirac matrices *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`DiracGamma`", "HighEnergyPhysics`FeynCalc`"]; DiracGamma::usage = "DiracGamma[x, dim] is the head of all Dirac matrices and slashes (in the internal representation). Use DiracMatrix (or GA, GAD) and DiracSlash (or GS, GSD) for manual (short) input. DiraGamma[x, 4] simplifies to DiracGamma[x]."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; dot := dot = MakeContext["DOT"]; MakeContext[ LorentzIndex, Momentum, DeclareNonCommutative, DiracGammaT]; DeclareNonCommutative[DiracGamma]; SetAttributes[DiracGamma, Constant]; DiracGamma /: Transpose[DiracGamma[a__]] := DiracGammaT[a]; DiracGamma[] = 1; DiracGamma[x_ Momentum[pe_, di___], dii___] := x DiracGamma[Momentum[pe, di], dii]; DiracGamma[x_ LorentzIndex[pe_, di___], dii___] := x DiracGamma[LorentzIndex[pe, di], dii]; DiracGamma[x_[y_, di___], 4] := DiracGamma[x[y,di]]; DiracGamma[5, __] := DiracGamma[5]; DiracGamma[6, __] := DiracGamma[6]; DiracGamma[7, __] := DiracGamma[7]; DiracGamma[_, 0] := 0; DiracGamma[0] = 0; DiracGamma[0, _] := 0; DiracGamma[a_Plus] := Map[DiracGamma, a]; DiracGamma[Momentum[x_,dix___], Momentum[y_,diy___]] := dot[ DiracGamma[Momentum[x,dix], dix], DiracGamma[Momentum[y,diy], diy]]; DiracGamma[Momentum[x_,dix___], Momentum[y_,diy___], z__] := dot[ DiracGamma[Momentum[x,dix], dix], DiracGamma[Momentum[y,diy], diy], DiracGamma[z]]; DiracGamma[LorentzIndex[x_,dix___], LorentzIndex[y_,diy___]] := dot[ DiracGamma[LorentzIndex[x,dix], dix], DiracGamma[LorentzIndex[y,diy], diy]]; DiracGamma[LorentzIndex[x_,dix___], LorentzIndex[y_,diy___], z__] := dot[ DiracGamma[LorentzIndex[x,dix], dix], DiracGamma[LorentzIndex[y,diy], diy], DiracGamma[z]]; DiracGamma[LorentzIndex[x_,dix___], Momentum[y_,diy___]] := dot[ DiracGamma[LorentzIndex[x,dix], dix], DiracGamma[Momentum[y,diy], diy]]; DiracGamma[LorentzIndex[x_,dix___], Momentum[y_,diy___], z__] := dot[ DiracGamma[LorentzIndex[x,dix], dix], DiracGamma[Momentum[y,diy], diy], DiracGamma[z]]; DiracGamma[Momentum[x_,dix___], LorentzIndex[y_,diy___]] := dot[ DiracGamma[Momentum[x,dix], dix], DiracGamma[LorentzIndex[y,diy], diy]]; DiracGamma[Momentum[x_,dix___], LorentzIndex[y_,diy___], z__] := dot[ DiracGamma[Momentum[x,dix], dix], DiracGamma[LorentzIndex[y,diy], diy], DiracGamma[z]]; DiracGamma[LorentzIndex[x_], di_Symbol-4 ] := 0; (* 4, D-4 *) DiracGamma[Momentum[x_], di_Symbol-4 ] := 0; (* 4, D-4 *) DiracGamma[Momentum[x_, di_Symbol -4]] := 0; (* D-4, 4 *) DiracGamma[LorentzIndex[x_, di_Symbol -4]] := 0; (* D-4, 4 *) DiracGamma[LorentzIndex[x_, di_], di_Symbol-4] := DiracGamma[LorentzIndex[x, di-4], di-4]; DiracGamma[Momentum[x_, di_], di_Symbol-4]:= DiracGamma[Momentum[x, di-4], di-4]; (* D-4, D *) DiracGamma[LorentzIndex[x_, di_Symbol-4], di_Symbol] := DiracGamma[LorentzIndex[x,di-4], di-4]; DiracGamma[Momentum[x_, di_Symbol-4], di_Symbol] := DiracGamma[Momentum[x,di-4], di-4]; DiracGamma[ LorentzIndex[x_], di_Symbol]:= DiracGamma[LorentzIndex[x]]; DiracGamma[ n_. Momentum[x_], di_Symbol] := (n DiracGamma[Momentum[x]]) /; NumberQ[n]; DiracGamma[Momentum[x_,di_Symbol]] := DiracGamma[Momentum[x]]; (* D, 4 *) DiracGamma[LorentzIndex[x_,di_Symbol]] := DiracGamma[LorentzIndex[x]]; (* D, 4 *) Pair = MakeBoxes["Pair"]; DiracGamma /: MakeBoxes[ DiracGamma[a_, di___], TraditionalForm ] := MakeBoxes[ HighEnergyPhysics`FeynCalc`Pair`Pair[ HighEnergyPhysics`FeynCalc`Momentum`Momentum["\[Gamma]",di],a], TraditionalForm ] /; !FreeQ[a, Momentum]; DiracGamma /: MakeBoxes[ DiracGamma[n_Integer, ___], TraditionalForm ] := SuperscriptBox["\[Gamma]", n]; DiracGamma /: MakeBoxes[ DiracGamma[lo_[in_], ru___Rule], TraditionalForm ] := (SuperscriptBox[RowBox[{OverscriptBox["\[Gamma]", "_"]}], Tbox[in]] ) /; $BreitMaison === True && lo === LorentzIndex; DiracGamma /: MakeBoxes[ DiracGamma[lo_[in_], ru___Rule], TraditionalForm ] := (SuperscriptBox["\[Gamma]", Tbox[lo[in]]] ) /; $BreitMaison === False && lo === LorentzIndex; DiracGamma /: MakeBoxes[ DiracGamma[lo_[in_,d_Symbol], _Symbol, ru___Rule], TraditionalForm ] := (SuperscriptBox["\[Gamma]", Tbox[lo[in,d]]] ) /; lo === LorentzIndex; DiracGamma /: MakeBoxes[ DiracGamma[lo_[in_, d_Symbol-4], d_Symbol-4, ru___Rule], TraditionalForm ] := SuperscriptBox[RowBox[{OverscriptBox["\[Gamma]","^"]}], Tbox[in] ] /; lo === LorentzIndex; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "DiracGamma | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: DiracGammaCombine *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: File created on 22 June '97 at 22:58 *) (* ------------------------------------------------------------------------ *) (* :Summary: The inverse of DiracGammaExpand *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`DiracGammaCombine`", "HighEnergyPhysics`FeynCalc`"]; DiracGammaCombine::usage= "DiracGammaCombine[exp] is (nearly) the inverse operation to DiracGammaExpand."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; MakeContext[ DiracGamma, FeynCalcInternal, FreeQ2, GS, GSD, Momentum]; DiracGammaCombine[y_] := If[!FreeQ2[y,{GS, GSD}], FeynCalcInternal[y]//dircg, y//dircg ]; dircg[x_Plus] := If[Length[x] > 8, Map[DiracGammaCombine, x], x //. gasumrules]; dircg[exp_] := exp //. gasumrules; (* merge sums of DiracGamma's into one *) gasumrules = {n1_. DiracGamma[Momentum[x_,di___],di___] + n2_. DiracGamma[Momentum[y_,di___],di___] :> DiracGamma[ Momentum[n1 x + n2 y,di], di ] /; (NumberQ[n1] && NumberQ[n2]), (n1_. DiracGamma[Momentum[x_, di___], di___] + n2_. DiracGamma[Momentum[x_, di___], di___] ):> (n1+n2) DiracGamma[Momentum[x, di], di], (n3_. Momentum[x_,di___] + n4_. Momentum[y_,di___]):> Momentum[ Expand[n3 x + n4 y],di]/;(NumberQ[n3]&&NumberQ[n4]) }; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "DiracGammaCombine | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: DiracGammaExpand *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: File created on 22 June '97 at 22:58 *) (* ------------------------------------------------------------------------ *) (* :Summary: expands DiracGamma[ exp_Plus ] *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`DiracGammaExpand`", "HighEnergyPhysics`FeynCalc`"]; DiracGammaExpand::usage= "DiracGammaExpand[exp] expands all DiracGamma[Momentum[a+b+..]] in exp into (DiracGamma[Momentum[a]] + DiracGamma[Momentum[b]] + ...)."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; MakeContext[ DiracGamma, MomentumExpand, Momentum]; DiracGammaExpand[x_] := If[FreeQ[x, DiracGamma], MakeContext["FeynCalcInternal"][x], x ] /. DiracGamma -> gaev /. gaevlin -> DiracGamma; gaev[x_,di___] := gaevlin[Expand[x//MomentumExpand, Momentum], di]; gaevlin[n_Integer] := DiracGamma[n]; (* necessary !!!!!! *) gaevlin[x_Plus, di___] := Map[gaevlin[#, di]&, x]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "DiracGammaExpand | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: DiracGammaT *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: File created on 9 December '98 at 18:49 *) (* ------------------------------------------------------------------------ *) (* :Summary: DiracGammaT denotes the a transposed DiracGamma *) (* :Comments: still experimental !!! check SUSY-calculations *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`DiracGammaT`", "HighEnergyPhysics`FeynCalc`"]; DiracGammaT::usage = "DiracGammaT[x] denotes the transpose of DiracGamma. Transpose[DiracGammaT[x]] gives DiracGamma[x]. Note that x must have Head LorentzIndex or Momentum."; (* DiracGammaT[a_ /; (Head[a] =!= LorentzIndex) && (Head[a] =!= Momentum) ] := *) (* ------------------------------------------------------------------------ *) Begin["`Private`"]; MakeContext[ DeclareNonCommutative, DiracGamma, LorentzIndex, Momentum]; DeclareNonCommutative[DiracGammaT]; (* DiracGammaT[a_/; (Head[a] =!= Momentum) && (Head[a] =!= LorentzIndex),___ ] := (Message[] ; False); *) DiracGammaT /: Transpose[DiracGammaT[a__]] := DiracGamma[a]; DiracGammaT /: MakeBoxes[DiracGammaT[a_,___], TraditionalForm] := SubsuperscriptBox["\[Gamma]", Tbox[a], "T"] /; (Head[a] === LorentzIndex) || (Head[a] === Integer); DiracGammaT /: MakeBoxes[DiracGammaT[a_,___], TraditionalForm] := SuperscriptBox[Tbox["(","\[Gamma]", "\[CenterDot]", a, ")"], "T"] /; Head[a] === Momentum; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "DiracGammaT | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: DiracMatrix *) (* :Author: Rolf Mertig *) (* :Summary: *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`DiracMatrix`", "HighEnergyPhysics`FeynCalc`"]; DiracMatrix::usage = "DiracMatrix[m] denotes a Dirac gamma matrix with Lorentz index m. DiracMatrix[m1, m2, ..] is a product of gamma matrices with Lorentz indices m1, m2, etc. DiracMatrix[5] is gamma5."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; MakeContext[ DeclareNonCommutative, Dimension, DiracGamma, LorentzIndex]; fci := fci = MakeContext["FeynCalcInternal"]; Options[DiracMatrix] = {Dimension -> 4, fci -> True}; DeclareNonCommutative[DiracMatrix]; DiracMatrix[a_Integer] := DiracGamma[a]; DiracMatrix[a_Dot, opt___Rule] := Map[DiracGamma[LorentzIndex[#, Dimension /. {opt} /. Options[DiracMatrix]], Dimension /. {opt} /. Options[DiracMatrix]]&, a]; DiracMatrix[a_, opt___Rule] := (DiracGamma[LorentzIndex[a, Dimension /. {opt} /. Options[DiracMatrix]], Dimension /. {opt} /. Options[DiracMatrix]] ) /; Head[a] =!= Integer; DiracMatrix /: MakeBoxes[DiracMatrix[x_], TraditionalForm ] := SuperscriptBox["\[Gamma]", MakeBoxes[x, TraditionalForm] ]; DiracMatrix /: MakeBoxes[DiracMatrix[x_,y___,z_/;Head[z]=!=Rule], TraditionalForm ] := RowBox @ Map[ SuperscriptBox["\[Gamma]", MakeBoxes[#, TraditionalForm] ]&, {x,y,z} ]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "DiracMatrix | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: DiracOrder *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: last changed July 19th 2000 *) (* ------------------------------------------------------------------------ *) (* :Summary: *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`DiracOrder`", "HighEnergyPhysics`FeynCalc`"]; DiracOrder::usage= "DiracOrder[expr] orders the Dirac matrices in expr alphabetically. DiracOrder[expr, orderlist] orders the Dirac matrices in expr according to orderlist."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; memset:= memset = MakeContext["MemSet"]; diracgamma := diracgamma = MakeContext["DiracGamma"]; dotsimplify:= dotsimplify = MakeContext["DotSimplify"]; expanding := expanding = MakeContext["Expanding"]; fci := fci = MakeContext["FeynCalcInternal"]; pair := pair = MakeContext["Pair"]; sCO := sCO = MakeContext["PairContract"]; dot := dot = MakeContext["DOT"]; des := des = MakeContext["DiracTrick"]; dotLin[z_] := dotsimplify[z(*/.Dot -> dot*), expanding -> False]; diraccanonical[ x_,y__ ]:=diraccanonical[x.y]; diraccanonical[x_]:=memset[diraccanonical[x], Block[{diraccanres}, (*diraccanonicaldef*) diraccanres = x//.{ de_[a___,diracgamma[vl_[y__],di___], diracgamma[lv_[z__],dim___],b___ ] :>( (-des[a,diracgamma[lv[z],dim], diracgamma[vl[y],di],b ] +( (2 sCO[vl[y],lv[z]] des[a,b])/.sCO->(*scev*)pair) )/.sCO->(*scev*)pair )/; !OrderedQ[{lv[y],vl[z]}] } /. dot -> des /. des -> dot; (* change here in Expand : 24.5.93 *) diraccanres = Expand[dotLin[ diraccanres ], diracgamma ] /. pair -> sCO /. sCO->pair; diraccanres] ]; DiracOrder[x__] := diracord@@fci[{x}]; diracord[x_] := FixedPoint[diraccanonical, x, 42]; diracord[x_,y___,z_] := FixedPoint[diraccanonical, dot[x,y,z], 42]/;Head[z]=!=List; diracord[x_,y__,ord_List] := diracord[dot[x,y],ord]; diracord[x_,ord_List] := memset[diracord[x,ord], Block[ {diracordrev=Reverse[ord], diracordz, diracordres=x,diracordi}, Do[ diracordz = diracordrev[[diracordi]]; diracordres = diracordres//. {de_[a___,diracgamma[vl_[y__],di___], diracgamma[lv_[diracordz0_,dime___],dim___],b___ ] :> ( (-des[a,diracgamma[lv[diracordz0,dime],dim], diracgamma[vl[y],di],b ]+ ( 2 sCO[vl[y],lv[diracordz0,dime]] des[a,b] )/.sCO->pair ) ) /; !FreeQ[lv[diracordz0, dime], diracordz] } /. dot -> des /. des -> dot, {diracordi,1,Length[ord]} ]; (Expand[dotLin[diracordres], diracgamma])/.pair->sCO/.sCO->pair]]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "DiracOrder | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: DiracReduce *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: Last changed July 19th 2000 *) (* ------------------------------------------------------------------------ *) (* :Summary: contraction and simplification rules for gamma matrices *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`DiracReduce`", "HighEnergyPhysics`FeynCalc`"]; DiracReduce::usage= "DiracReduce[exp] reduces all four-dimensional Dirac matrices in exp to the standard basis (S,P,V,A,T) using the Chisholm identity (see Chisholm). In the result the basic Dirac structures are wrapped with a head DiracBasis. I.e.: S corresponds to DiracBasis[1], P : DiracBasis[DiracMatrix[5]], V : DiracBasis[DiracMatrix[mu]], A: DiracBasis[DiracMatrix[mu, 5]], T: DiracBasis[DiracSigma[DiracMatrix[mu, nu]]]. By default DiracBasis is substituted to Identity. \n Notice that the result of DiracReduce is given in the FeynCalcExternal - way, i.e., evtl. you may have to use FeynCalcInternal on result."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; MakeContext[ Chisholm, Collect2, Contract]; dot := dot = MakeContext["DOT"]; MakeContext[ DiracBasis, DiracGamma, DiracMatrix, DiracOrder, DiracSigma, DiracSigmaExplicit, DiracSimplify, DiracSubstitute67, Eps, Factor2, Factoring, FinalSubstitutions, FCE, FCI, LorentzIndex, Pair, Rename]; Options[DiracReduce] = {Factoring -> False, FinalSubstitutions -> {DiracBasis -> Identity} }; DiracReduce[x_, {ops___Rule}] := DiracReduce[x, ops]; DiracReduce[x_, ops___Rule] := Block[{temp = FCI[x], spart, n1, n2, ddb, res, finsub,finsub1,factoring}, finsub1 = If[ Length[{ops}] === 0, {}, If[!FreeQ[{ops}, FinalSubstitutions], FinalSubstitutions /. {ops}, Select[Flatten[{ops}], FreeQ[#,Factoring]&]] ]; finsub = Join[finsub1, FinalSubstitutions /. Options[DiracReduce]]; factoring = Factoring /. {ops} /. Options[DiracReduce]; (* do first usual DiracSimplify *) temp = DiracSimplify[temp, DiracSubstitute67 -> True, DiracSigmaExplicit -> False]; If[$VeryVerbose > 1, Print["DiracSimplify done"]]; (* Chisholm identity recursively *) temp = Chisholm[temp]//DiracOrder; If[$VeryVerbose > 1, Print["Chisholm done"]]; temp = Expand[temp, DiracGamma]; (* introduce DiracSigma *) (* use gamma[m,n, 5] = 1/2 ( eps[m,n,r,s] sig[r,s] + 2 g[m,n] gamma[5] ) *) temp = temp /. dot[DiracGamma[a_[xx_]], DiracGamma[b_[yy_]], DiracGamma[5] ] :> ( un1 = Unique[mU1]; un2 = Unique[mU2]; Expand[ 1/2 (Eps[a[xx], b[yy], LorentzIndex[un1], LorentzIndex[un2]] * (I/2) (FCI[ DiracMatrix[un1, un2] - DiracMatrix[un2, un1] ]) + 2 Pair[a[xx], b[yy]] DiracGamma[5]) ] ); (* for the renaming of dummy indices *) temp = Contract[temp, Rename-> True]; (* XXX *) temp = temp /. dot[DiracGamma[a_[xx_]], DiracGamma[b_[yy_]]] :> ( -I DiracSigma[DiracGamma[a[xx]], DiracGamma[b[yy]]] + Pair[b[yy], a[xx]] ); temp = Contract[DiracSimplify[temp, DiracSigmaExplicit -> False]]; temp = Collect2[temp, DiracGamma, Factoring -> factoring]; If[$VeryVerbose > 1, Print["collecting done"]]; (* get the S - part *) spart = Select[temp + n1 + n2, FreeQ[#, DiracGamma]&] /. {n1 :> 0, n2 :> 0}; temp = temp - spart; If[factoring === False, spart = Expand[spart] DiracBasis[1], If[factoring === True, spart = Factor2[spart] DiracBasis[1], spart = factoring[spart] DiracBasis[1]] ]; ddb[y__] := DiracBasis[dot[y]]; res = spart + (temp /. DiracSigma[a__] :> DiracBasis[FCE[DiracSigma[a]]] /. dot[DiracGamma[a_], DiracGamma[5]] :> DiracBasis[FCE[dot[DiracGamma[a], DiracGamma[5]]]] /. DiracGamma[a_] :> DiracBasis[FCE[DiracGamma[a]]]); res = res /. finsub /. finsub; res = FCE[res]; res = res /. finsub /. finsub; res]; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "DiracReduce | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: DiracSigma *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: File created on 6 August '97 at 0:26 *) (* ------------------------------------------------------------------------ *) (* :Summary: DiracSigma[x,y] = I/2 (x . y - y . x ) DiracSigma[DiracMatrix[x,y]] = I/2 (DiracMatrix[x, y] - DiracMatrix[y, x]) *) (* :Title: DiracSimpCombine *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: created 4 March '97 at 14:34 *) (* ------------------------------------------------------------------------ *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`DiracSimpCombine`", "HighEnergyPhysics`FeynCalc`"]; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; DiracSimpCombine::usage= "DiracSimpCombine is an option for DiracSimplify. If set to True sums of DiracGamma's will be merges as much as possible in DiracGamma[ .. + .. + ]'s."; End[]; MyEndPackage[]; (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) If[$VeryVerbose > 0,WriteString["stdout", "DiracSimpCombine | \n "]]; Null (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *) (* :Title: DiracSimplify *) (* :Author: Rolf Mertig *) (* ------------------------------------------------------------------------ *) (* :History: File created on 20 December '98 at 23:00 *) (* ------------------------------------------------------------------------ *) (* :Summary: like DiracTrick, but including non-commutative expansion *) (* ------------------------------------------------------------------------ *) MyBeginPackage["HighEnergyPhysics`FeynCalc`DiracSimplify`", "HighEnergyPhysics`FeynCalc`"]; ChisholmSpinor::usage= "ChisholmSpinor[x] uses for a DiraGamma between spinors the Chisholm identity. As an optional second argument 1 or 2 may be given, indicating that ChisholmSpinor should only act on the first resp. second part of a product of spinor chains."; DiracSimplify::usage= "DiracSimplify[expr] simplifies products of Dirac matrices in expr and expands non-commutative products. Double Lorentz indices and four vectors are contracted. The Dirac equation is applied. All DiracMatrix[5], DiracMatrix[6] and DiracMatrix[7] are moved to the right. The order of the Dirac matrices is not changed."; (* ------------------------------------------------------------------------ *) Begin["`Private`"]; MakeContext[ Collect2, Contract, DiracCanonical, DiracOrder, DiracEquation, DiracGamma, DiracGammaCombine, DiracGammaExpand, DiracMatrix, DiracOrder, DiracSigmaExplicit, DiracSimpCombine, DiracSlash, DiracSubstitute67, DiracTrace]; dot := dot = MakeContext["DOT"]; dR := dR = MakeContext["DiracTrick"]; Eps := Eps = MakeContext["Eps"]; fcinte := fcinte = MakeContext["FeynCalcInternal"]; MakeContext[ DotSimplify, EpsContract, Expanding, Expand2, Factor2, FactorTime, FreeQ2, Factoring, InsideDiracTrace, LorentzIndex, MemSet, NonCommQ ]; sCO := sCO = MakeContext["PairContract"]; scev := scev = MakeContext["ExpandScalarProduct"]; MakeContext[ Pair, PartitHead, Spinor, GA, GAD, GS, GSD, SUNT, Tr]; (* SpinorsandPairs := SpinorsandPairs = MakeContext["SpinorsandPairs]"; *) Options[DiracSimplify] = { DiracCanonical -> False, DiracSigmaExplicit -> True, DiracSimpCombine->False, DiracSubstitute67 -> False, Expanding -> True, Factoring -> False, fcinte -> False, InsideDiracTrace -> False}; fcinter[x_] := If[ (fcinter /. Options[DiracSimplify]) === True, x, fcinte[x] ]; dotLin[x_] := If[FreeQ[x, Dot], x, DotSimplify[x, Expanding -> False]]; diracEq[x_]:= If[FreeQ[x, Spinor], x, DiracEquation[x]]; Options[diracSimplify] = {diracInfo->False, DiracCanonical->False, InsideDiracTrace->False, DiracSubstitute67->False, Factoring -> False, DiracSimpCombine->False }; dit[x_,ops___Rule]:=DiracTrace[diracSimplify@@Join[{x},{ops}, Flatten[Prepend[{Options[DiracSimplify]}, InsideDiracTrace -> True]] ] ]; (* DiracSimplifydef*) DiracSimplify[x_,y__, z___Rule]:=DiracSimplify[dot[x,y], z]; diracSimplify[z_, ru___Rule]:= (Contract[z]/.DiracTrace->dit)/;!FreeQ[z,DiracTrace]; (* dS[]=1; *) dS[x__] := MemSet[dS[x], dR[x]]; (* dS = HighEnergyPhysics`FeynCalc`DiracTrick`Private`ds; *) (* ****************************************************************** *) DiracSimplify[a_, opt___Rule] := a /; FreeQ2[a, {DiracGamma,DiracSlash,DiracMatrix, GA[__],GS[__],GAD[__],GSD[__]}]; DiracSimplify[a_, opts___Rule] := If[ (Expanding /. {opts} /. Options[DiracSimplify]) === False, If[(DiracSigmaExplicit /. {opts} /. Options[DiracSimplify]) === True, DiracSigmaExplicit[diracEq[dotLin[a // fcinter] (* /. dot -> dS*)] ], diracEq[dotLin[a // fcinter] (* /. dot -> dS *)] ], If[$VeryVerbose>2, Print["doing oldDiracSimplify on ", StandardForm[a]]]; oldDiracSimplify[ If[(DiracSigmaExplicit /. {opts} /. Options[DiracSimplify]) === True, DiracSigmaExplicit[ fcinter[a] /. Pair -> sCO (* 27-Mar-2003 /. dot -> dS *)], fcinter[a] /. Pair -> sCO (* 27-Mar-2003/. dot -> dS *) ], opts ] /. sCO -> Pair ]; (* ****************************************************************** *) oldDiracSimplify[x_,y___Rule] := diracSimplify[Global`CHECK=x,y] /; FreeQ[x, Spinor]; oldDiracSimplify[x_,yy___Rule] := Block[{dre}, If[$VeryVerbose>2, Print["entering oldDiracSimplify", x]]; (*NEW0796*) dre = Collect[DotSimplify[dR[DiracGammaCombine[x]]]/. dot->dooo,dooo[__]]/.dooo->dot; dre = FixedPoint[ SpinorChainEvaluate, dre, 142]; If[ !FreeQ[dre, Eps], dre = Contract[dre, EpsContract -> True]; dre = FixedPoint[ SpinorChainEvaluate, dre, 142] , If[!FreeQ[dre, LorentzIndex], (* dre = Contract[dre] *) dre = Contract[dre, Expanding -> False] ]; dre = FixedPoint[ SpinorChainEvaluate, dre, 142]; ]; If[!FreeQ[dre, LorentzIndex], print2["contracting in oldDiracSimpify"]; dre = Contract[dre]; print2["contracting in oldDiracSimpify done"]; ]; If[Length[DownValues[SpinorsandPairs] ] > 1, dre = (dre /. dot -> SpinorsandPairs/. SpinorsandPairs->dot )//dotLin ]; (* If[FreeQ[dre,dot] || (!FreeQ[dre,StandardMatrixElement]), dre = Expand[dre, StandardMatrixElement] ]; *) If[!FreeQ[dre, DiracGamma], dre = Expand2[dre, DiracGamma]]; If[LeafCount[dre] < 420, dre = Factor2[dre, FactorTime->10]]; dre ] /; !FreeQ[x,Spinor]; collone[x_,y_]:=Collect2[x,y, Factoring -> False]; (* #################################################################### *) gamma67back[x_] := x/.DiracGamma[6] -> (1/2 + DiracGamma[5]/2)/. DiracGamma[7] -> (1/2 - DiracGamma[5]/2); contractli[x_] := MemSet[contractli[x], Contract[ x, Expanding -> True, Factoring -> False, EpsContract -> False ] ]; (*diracSimplifydef *) (*XXX1 *) (* diracSimplify[x_ /; NonCommQ[x],in___] := x; *) diracSimplify[x_,in___] := x /; NonCommQ[x]; (*CHANGE 1298 *) diracSimplify[x_,in___Rule]:= If[FreeQ[x, DiracGamma], x, MemSet[diracSimplify[x,in], Block[ {diracopt,diracdt,diracndt=0,diraccanopt,diracpdt,diracgasu, diracldt,diracjj=0,info,diractrlabel,diracga67,diracsifac, diracpag,colle }, (* There are several options *) diracopt = Join[ Flatten[{in}],Options[diracSimplify] ]; info = diracInfo/.diracopt; diraccanopt = DiracCanonical/.diracopt; diractrlabel = InsideDiracTrace/.diracopt; diracga67 = DiracSubstitute67/.diracopt; diracgasu = DiracSimpCombine/.diracopt; diracsifac = Factoring/.diracopt; diracdt = dotLin[ x//DiracGammaExpand ]; If[$VeryVerbose > 2,Print["dir1"]]; If[ diracgasu === True, diracdt = contractli[DiracGammaCombine[diracdt/.Pair->sCO] ] (* 27-Mar-2003 /. dot -> dS *) , diracdt = contractli[ diracdt ] (* 27-Mar-2003 /.dot->dS *) ]; If[diractrlabel===True, (* diracdt = diracdt/.dR->trIC/.trI->dS//. dR->drCOs/.drCO->trIC/.trI->dS; *) diracdt = diracdt/.dot->trIC/.trI->dS; (* optimization *) colle[a_]:=If[ (Length[a]<20(*00*))||(Head[a]=!=Plus), a, Collect2[a, dot, Factoring -> False] ]; dirfun[exp_]:=colle[exp/.dot->dS/.dot -> trIC /. trI->dot]; diracdt = FixedPoint[dirfun, diracdt]/.dot ->trIC/.trI->dS; If[$VeryVerbose>2,Print["dir2done"]]; If[ FreeQ[ diracdt, dot ], diracdt = diracdt/.DiracGamma[_[__],___]->0; diracpag=PartitHead[diracdt,DiracGamma]; If[ diracpag[[2]] === DiracGamma[5], diracdt = 0 ]; If[ diracpag[[2]] === DiracGamma[6] || diracpag[[2]] === DiracGamma[7], diracdt = 1/2 diracpag[[1]] ] ] ]; (* change 27-Mar-2003 by RM, because of http://www.feyncalc.org/forum/0121.html*) If[$VeryVerbose > 2,Print["dir2a"]]; diracdt = Expand2[ scev[diracdt//fEx], {Pair, dot}]; If[$VeryVerbose>2,Print["dir3"]]; If[FreeQ[diracdt,dot], diracndt=Expand[(diracdt/.sCO->scev)//DiracGammaExpand]; If[diracga67 === True, diracndt = Expand[diracndt//gamma67back]] , If[$VeryVerbose>2,Print["dir3 expanding "]]; diracdt = Expand[ diracdt ]; If[$VeryVerbose>2,Print["dir3 expanding done ", Length[diracdt]]]; If[ Head[diracdt] === Plus, diracldt=Length[diracdt], If[ diracdt===0, diracldt = 0, diracldt = 1 ] ]; If[$VeryVerbose>2, Print["in diracSimplify: working with ",diracldt," terms"]]; While[diracjjtrIC/.trI->dS//. dot -> trIC/.trI->dS; diracpdt = diracpdt//.dot -> dS ]; (* maybe insert some TimeConstrained here later *) If[$VeryVerbose>2, Print["in diracSimplify: contraction done, expand now."]]; diracpdt = scev[ diracpdt ]//Expand; (* diracpdt = Expand[ diracpdt]; *) If[diractrlabel===True, diracpdt = fEx[(diracpdt//DiracGammaExpand)/.dot->dS]/. dot->trIC/.trI->dS//.dot->dS/. dot->trIC/.trI->dS, diracpdt = fEx[DiracGammaExpand[diracpdt]/.dot->dS]//. dot->dS ]; If[ diracga67===True, diracpdt = gamma67back[ diracpdt/.dot->dr67 ], diracpdt = fEx[ diracpdt ] ]; diracndt = diracndt + Expand2[ diracpdt, dot ]; If[ info===True || $VeryVerbose > 2, Print["# ",diracjj," / ",diracldt," = ", Length[diracndt] ] ] ]; diracndt = diracndt/.dr->dot/.sCO->scev; diracndt = Expand[dotLin[diracndt]]; If[ (diraccanopt===True ), print3["diracordering in diracSimplify"]; diracndt = DiracOrder[ diracndt ] ; diracndt = Expand[dotLin[diracndt]] ]; ] (* If FreeQ[diracdt,dr] *); If[$VeryVerbose>2, Print["dir4 ",diracdt]]; print3["diracdt = ", diracdt ]; diracndt = dotLin[diracndt]; If[$VeryVerbose>2, Print["dir5"]]; If[ diracsifac === True, diracndt = Factor2[ diracndt ] ]; If[$VeryVerbose>2, Print["dir6"]]; print3["exiting diracSimplify"]; diracndt]]]; (* end of diracSimplify *) (* #################################################################### *) (*dr67def*) dr67[ b___ ] := dS[ b ]/;FreeQ2[{b},{DiracGamma[6],DiracGamma[7]}]; dr67[ b___,DiracGamma[6],z___ ] := 1/2 dS[b,z] + 1/2 dS[ b,DiracGamma[5],z ]; dr67[ b___,DiracGamma[7],z___ ] := 1/2 dS[b,z] - 1/2 dS[ b,DiracGamma[5],z ]; dIex[ a___,x_ + y_, b___] := dS[a,x,b] + dS[a,y,b]; (*dIexdef*) (*dixdef*) dix[y_] := y/.dot->dIex/.dIex->dS; (* #################################################################### *) (* ************************************************************** *) (* This is the tricky function which does the expansion of the dr's *) fEx[z_]:=FixedPoint[ dix, z/.dot -> dS ]; (*fExdef*) (* ************************************************************** *) (* cyclic property *) trIC[y___]:=If[$Kreimer =!= True, tris @@ cyclic[y], tris[y] ]; cyclic[x__]:=RotateLeft[{x},Position[{x},First[Sort[{x}]]][[1,1]]]; cyclic[]:={}; (* ************************************************************** *) (* fr567def, frlivcdef : two special FreeQ - checking functions *) fr567[x__] := True /; FreeQ2[FixedPoint[ReleaseHold, {x}], {DiracGamma[5],DiracGamma[6],DiracGamma[7]}]; (* Properties and special cases of traces (up to a factor 4) *) tris[x___] := tris[x] = trI[x]; (*trisdef*) trI[a_+b_] := tris[a] + tris[b]; (*trIdef*) trI[] = 1; trI[ DiracGamma[5] ] = 0; trI[ DiracGamma[6] ] = 1/2; trI[ DiracGamma[7] ] = 1/2; trI[ a:DiracGamma[_[__]].. ,DiracGamma[n_] ] := 0 /; (OddQ[Length[{a}]]&&(n==5 || n==6 || n==7)); trI[ a:DiracGamma[_[__],___].. ,DiracGamma[n_] ] := 0 /; (OddQ[Length[{a}]]&&(n==5 || n==6 || n==7)) && ($BreitMaison === False); trI[ d:DiracGamma[__].. ] := 0/;(OddQ[Length[{d}]] && fr567[ d ]); trI[ d:DiracGamma[_[__],___].. ,DiracGamma[5] ] := 0/;Length[{d}]<4; trI[x_] := x /; FreeQ[ {x},DiracGamma ]; trI[ DiracGamma[a_[b__],___],DiracGamma[c_[d__],___], DiracGamma[6] ] := 1/2 scev[ a[b],c[d] ]; trI[ DiracGamma[a_[b__],___],DiracGamma[c_[d__],___], DiracGamma[7] ] := 1/2 scev[ a[b],c[d] ]; trI[ x__] := HighEnergyPhysics`FeynCalc`DiracTrace`Private`spursav[x]/; ( Length[{x}] < 11 && fr567[x]) || ( Length[{x}] < 6 && (!fr567[x])); (* #################################################################### *) (* SpinorChainEvaluatedef *) (* #################################################################### *) (* Main43 *) (* #################################################################### *) spinlin[x_Plus]:=spinlin/@x; spinlin[a_] :=( (a/.dot->ddot)//.{ ddot[x___,z_ b__,c___] :> z ddot[x,b,c]/;NonCommQ[z]===True, ddot[x___,z_ ,c___] :> z ddot[x,c]/;NonCommQ[z]===True, ddot[x_Spinor,b___,c_Spinor,d_Spinor,e___,f_Spinor,g___]:> ddot[x,b,c] ddot[d,e,f,g] } )/.ddot[]->1/.ddot->dot; SetAttributes[ SpinorChainEvaluate, Listable ]; SpinorChainEvaluate[y_]:=y /; FreeQ[y,Spinor]; (* #################################################################### *) (* Main44 *) (* #################################################################### *) SpinorChainEvaluate[z_Plus]:= Block[{nz}, nz = DotSimplify[z]; If[Length[nz]>20, nz= Collect2[ nz, Spinor,Factoring -> False] ]; If[Head[nz]=!=Plus, nz = SpinorChainEvaluate[nz], If[$sirlin =!= True, nz = Map[ spcev0, nz ], If[ FreeQ[nz, Spinor[p1__] . (a__ /; FreeQ[{a}, DiracGamma[_,_]] ) . Spinor[p2__] * Spinor[p3__] . (b__ /; FreeQ[{b}, DiracGamma[_,_]] ) . Spinor[p4__] ], nz = Map[ spcev0,nz ], nz = sirlin00[ Expand[Map[ spcev0,z//sirlin0 ]] ] ] ] ]; nz]; SpinorChainEvaluate[x_]:= If[$sirlin =!= True, Expand[spcev0[x], Spinor], If[ FreeQ[x//DotSimplify, Spinor[p1__] . (a__ /; FreeQ[{a}, DiracGamma[_,_]] ) . Spinor[p2__] * Spinor[p3__] . (b__ /; FreeQ[{b}, DiracGamma[_,_]] ) . Spinor[p4__] ], Expand[spcev0[x]], sirlin00[ Expand[FixedPoint[spcev0, x//sirlin0, 3 ]] ] ]]/; !Head[x]===Plus; (* #################################################################### *) (* Main45 *) (* #################################################################### *) spcev0[x_] := spcev000[x]/.spcev000->spcev0ev; (* spcev000[ a_ b_ ] := a spcev000[b] /; NonCommQ[a] === True; *) spcev000[y_] := y /; NonCommQ[y] === True; spcev000[y_Times] := Select[ y, FreeQ[#, Spinor]& ] spcev0ev[ Select[ y,!FreeQ[#, Spinor]& ] ]; spcev0ev[x_] := scev[Contract[ Expand[spinlin[x](*, Spinor*)]/.dot->spcevs/. spcev->dot, Expanding->False ] ](*//Expand*); spcevs[xx___] := MemSet[ spcevs[xx], FixedPoint[ spcev,{xx},4 ] ]; (*spcevsdef*) (*spcevdef*) spcev[y_List]:=spcev@@y; spcev[a___,b_ /; FreeQ2[b,{Pattern, BlankSequence, BlankNullSequence}], c___] := b spcev[a,c] /; NonCommQ[b] === True; spcev[] = 1; spcev[x___,Spinor[a__],y___] := Expand[ DiracOrder[ DiracEquation[fEx[DiracGammaExpand[ x.Spinor[a].y]](*/.dR->dot*) ] ] ]/; FreeQ[{x,y},Spinor]; spcev[x___,Spinor[a__],b___,Spinor[c__],y___] := Block[ {spcevdi,spcevre,spcevj}, If[$VeryVerbose > 2, Print["entering specv with ", InputForm[Dot@@{x,Spinor[a],b,Spinor[c],y}]]]; spcevdi = diracSimplify[dot[Spinor[a],b,Spinor[c]], InsideDiracTrace->False, (* DiracCanonical->True, *) DiracCanonical->False, diracInfo->False, Factoring->False, DiracSimpCombine->True ]; spcevdi = Expand[ scev[ spcevdi ] ]; spcevdi = Expand[ spcevdi(*,dot*) ]; If[ !(Head[spcevdi]===Plus), spcevre = spinlin[ spcevdi ]; spcevre = DiracEquation[ spcevre ]; (*spcevre = DiracOrder[ spcevre ]*), spcevre = Sum[(* DiracOrder[*) DiracEquation[ spinlin[ spcevdi[[spcevj]] ] ] (* ]*), {spcevj,1,Length[spcevdi]} ] ]; spcevre = DotSimplify[spcevs[x].spcevre.spcevs[y]]; If[ !FreeQ[spcevre, SUNT], spcevre = (spcevre/.dot->dS) ]; spcevre = spcevre//DotSimplify; If[$VeryVerbose > 2, Print["exiting specv with ",InputForm[spcevre]]]; spcevre] /; FreeQ[{b}, Spinor]; (* Reference of Sirlin-relations: Nuclear Physics B192 (1981) 93-99; Note that we take another sign in front of the Levi-Civita tensor in eq. (7), since we take (implicitly) \varepsilon^{0123} = 1 *) (* #################################################################### *) (* Main441 *) (* #################################################################### *) $SpinorMinimal = False; sirlin00[x_]:= x/;($SpinorMinimal === False) || ($sirlin===False); sirlin00[x_]:=MemSet[sirlin00[x], Block[{te, tg5, ntg5}, print3["sirlin001"]; (* te = sirlin0[x]//ExpandAll; *) te = sirlin0[x]//Expand; print3["sirlin002"]; If[FreeQ2[te,{DiracGamma[6],DiracGamma[7]}]&& Head[te]===Plus && !FreeQ[te,DiracGamma[5]], tg5 = Select[te, !FreeQ[#,DiracGamma[5]]& ]; ntg5 = te - tg5; (*i.e. te = tg5 + ntg5 *) test = Expand[tg5 + ChisholmSpinor[ntg5]]; If[nterms[test] < Length[te], te=test] ]; print3["exiting sirlin00"]; te]] /; $SpinorMinimal === True; (* ident3def *) ident3[a_,_]:=a; (* #################################################################### *) (* Main442 *) (* #################################################################### *) (* canonize different dummy indices *) (*sirlin3def*) sirlin3a[x_]:=((sirlin3[Expand[Contract[x](*,Spinor*)]/. $MU->dum$y]/.dum$y->$MU)/. sirlin3 -> Identity )//Contract; sirlin3[a_Plus]:=sirlin3 /@ a; sirlin3[ m_. Spinor[p1__]. (ga1___) . DiracGamma[ LorentzIndex[la_] ]. (ga2___) . Spinor[p2__] * Spinor[p3__]. (ga3___) . DiracGamma[ LorentzIndex[la_] ]. (ga4___) . Spinor[p4__] ]:= Block[{counter}, counter = 1; While[!FreeQ2[{m,ga1,ga2,ga3,a4}, {$MU[counter], dum$y[counter]} ], counter = counter + 1 ]; sirlin3[ m Spinor[p1] . ga1 . DiracGamma[ LorentzIndex[$MU[counter]] ] . ga2 . Spinor[p2] * Spinor[p3] . ga3 . DiracGamma[ LorentzIndex[$MU[counter]] ] . ga4 . Spinor[p4] ] ] /; FreeQ[la, $MU]; sirlin3[ m_. Spinor[p1__].(ga1___). DiracGamma[ LorentzIndex[la_,di_],di_ ]. (ga2___) . Spinor[p2__] * Spinor[p3__].(ga3___). DiracGamma[ LorentzIndex[la_,di_],di_ ]. (ga4___) . Spinor[p4__] ] := ( m Spinor[p1] . ga1 . DiracGamma[ LorentzIndex[$MU[1], di],di ] . ga2 . Spinor[p2] * Spinor[p3] . ga3 . DiracGamma[LorentzIndex[$MU[1], di], di] . ga4 . Spinor[p4] ) /; FreeQ2[{ga1,ga2,ga3,ga4}, DiracGamma[_,_]]; (* this is far from optimal, but for the moment sufficient *) $sirlin = True; (* #################################################################### *) (* Main443 *) (* #################################################################### *) (* The Sirlin - identities are only valid in 4 dimensions and are only needed, if Dirac matrices are around *) sirlin0[x_]:=If[$sirlin=!=True, x, If[ FreeQ2[x, {LorentzIndex, Momentum}], x, If[ FreeQ[x, Spinor], x, If[ !FreeQ[x, DiracGamma[_,_]], sirlin3[x]/.sirlin3->Identity, sirlin0doit[(x//sirlin2)/.sirlin2->Identity] ] ] ] ]; $sirlintime = 242; SetAttributes[timeconstrained, HoldAll]; If[$OperatingSystem === "Unix", timeconstrained[x__] := TimeConstrained[x], timeconstrained[x_,__] := x ]; sirlin0doit[a_Plus]:=timeconstrained[ sirlin3a[Contract[ (Expand[Map[sirlin1, a](*, dot*)]/. sirlin1->sirlin2) /. sirlin2 -> sirlin1/.sirlin1->sirlin2/. sirlin2 -> Identity,EpsContract->True] ] // spcev0, 2 $sirlintime, a ]; sirlin0doit[a_]:=timeconstrained[ (sirlin3a[sirlin1[a]/.sirlin1->sirlin2/. sirlin2 -> Identity ] // spcev0), $sirlintime, a ] /;Head[a]=!=Plus; (*sirlin2def*) sirlin2[a_Plus]:=sirlin2/@a; sirlin2[m_. Spinor[pa__] . DiracGamma[Momentum[pj_]] . DiracGamma[Momentum[pi_]] . DiracGamma[LorentzIndex[mu_]].(vg5___). Spinor[pb__] * Spinor[Momentum[pi_],0,qf___] . DiracGamma[LorentzIndex[mu_]] . (vg5___). Spinor[Momentum[pj_],0,qf___] ] := (-sirlin2[ m Spinor[pa] . DiracSlash[pi,pj] . DiracMatrix[mu] . vg5 . Spinor[pb] * Spinor[Momentum[pi],0,qf] . DiracMatrix[mu] . vg5 . Spinor[Momentum[pj],0,qf] ] + 2 m scev[Momentum[pi],Momentum[pj]] * Spinor[pa] . DiracMatrix[mu] . vg5 . Spinor[pb] * Spinor[Momentum[pi],0,qf] . DiracMatrix[mu] . vg5 . Spinor[Momentum[pj],0,qf] )/; ({vg5}==={}) || ({vg5}==={DiracGamma[5]}); sirlin2[m_. Spinor[pa__] . DiracGamma[Momentum[pi_]] . DiracGamma[Momentum[pj_]] . DiracGamma[LorentzIndex[mu_]].(vg5___). Spinor[pb__] * Spinor[Momentum[pi_],0,qf___] . DiracGamma[LorentzIndex[mu_]] . (vg5___). Spinor[Momentum[pj_],0,qf___] ] :=(m scev[Momentum[pi], Momentum[pj]] * Spinor[pa] . DiracMatrix[$MU[1]] . Spinor[pb] * Spinor[Momentum[pi],0,qf] . DiracMatrix[$MU[1]] . Spinor[Momentum[pj],0,qf] + m scev[Momentum[pi], Momentum[pj]] * Spinor[pa] . DiracMatrix[$MU[1]]. DiracGamma[5] . Spinor[pb] * Spinor[Momentum[pi],0,qf] . DiracMatrix[$MU[1]] . DiracGamma[5] . Spinor[Momentum[pj],0,qf] ) /; ({vg5}==={}) || ({vg5}==={DiracGamma[5]}); sirlin2[m_. Spinor[p1__]. (ga1___) . DiracGamma[ LorentzIndex[la_] ]. DiracGamma[ LorentzIndex[nu_] ]. DiracGamma[6] . Spinor[p2__] * Spinor[p3__]. (ga2___) . DiracGamma[ LorentzIndex[la_] ]. DiracGamma[ LorentzIndex[nu_] ]. DiracGamma[7] . Spinor[p4__] ] := ( m 4 Spinor[p1] . ga1 . DiracGamma[6] . Spinor[p2] * Spinor[p3] . ga2 . DiracGamma[7] . Spinor[p4] ); sirlin2[m_. Spinor[p1__]. (ga1___) . DiracGamma[ LorentzIndex[la_] ]. DiracGamma[ LorentzIndex[nu_] ]. DiracGamma[7] . Spinor[p2__] * Spinor[p3__]. (ga2___) . DiracGamma[ LorentzIndex[la_] ]. DiracGamma[ LorentzIndex[nu_] ]. DiracGamma[6] . Spinor[p4__] ] := ( m 4 Spinor[p1] . ga1 . DiracGamma[7] . Spinor[p2] * Spinor[p3] . ga2 . DiracGamma[6] . Spinor[p4] ); (* #################################################################### *) (* Main444 *) (* #################################################################### *) (* eq. (8) *) sirlin2[m_. Spinor[p1__]. (ga1___) . DiracGamma[ LorentzIndex[mu_] ]. DiracGamma[ lv_[rho_] ] . DiracGamma[ LorentzIndex[nu_] ]. (ga2___) . Spinor[p2__] * Spinor[p3__]. (ga3___) . DiracGamma[ LorentzIndex[mu_] ]. DiracGamma[ lvt_[tau_] ] . DiracGamma[ LorentzIndex[nu_] ]. (ga4___) . Spinor[p4__] ] := Block[{ii=1, ind, la, grho, gtau, gam5}, While[!FreeQ[{ga1,ro,ga2,ga3,tau,ga4}, $MU[ii]], ii++]; la = DiracGamma[LorentzIndex[$MU[ii]]]; grho = DiracGamma[lv[rho]]; gtau = DiracGamma[lvt[tau]]; gam5 = DiracGamma[5]; Contract[ 2 m Pair[lv[rho], lvt[tau]] * Spinor[p1] . ga1 . la . ga2 . Spinor[p2] * Spinor[p3] . ga3 . la . ga4 . Spinor[p4] + 2 m * Spinor[p1] . ga1 . gtau . ga2 . Spinor[p2] * Spinor[p3] . ga3 . grho . ga4 . Spinor[p4] + 2 m Pair[lv[rho], lvt[tau]] * Spinor[p1] . ga1 . la . ga2 . gam5 . Spinor[p2] * Spinor[p3] . ga3 . la . ga4 . gam5 . Spinor[p4] - 2 m * Spinor[p1] . ga1 . gtau . ga2 . gam5 . Spinor[p2] * Spinor[p3] . ga3 . grho . ga4 . gam5 . Spinor[p4] ] ]; (* eq. (12) of Sirlin *) sirlin2[m_. Spinor[p1__]. DiracGamma[ LorentzIndex[mu_] ]. DiracGamma[ lv_[rho_] ] . DiracGamma[ LorentzIndex[sigma_] ]. DiracGamma[ lvt_[tau_] ]. DiracGamma[ LorentzIndex[nu_] ]. om_ . Spinor[p2__] * Spinor[p3__]. DiracGamma[ LorentzIndex[mu_] ]. DiracGamma[ lva_[alpha_] ] . DiracGamma[ LorentzIndex[sigma_] ]. DiracGamma[ lvb_[beta_] ]. DiracGamma[ LorentzIndex[nu_] ]. om_ . Spinor[p4__] ] := Contract[ m 16 Pair[lvt[tau],lvb[beta]] * Pair[lv[rho], lva[alpha]] * Spinor[p1] . DiracMatrix[mu] . om . Spinor[p2] * Spinor[p3] . DiracMatrix[mu] . om . Spinor[p4] ] /; (om===DiracGamma[6]) || (om===DiracGamma[7]); (* eq. (13) of Sirlin *) sirlin2[m_. Spinor[p1__]. DiracGamma[ LorentzIndex[mu_] ]. DiracGamma[ lv_[rho_] ] . DiracGamma[ LorentzIndex[sigma_] ]. DiracGamma[ lvt_[tau_] ]. DiracGamma[ LorentzIndex[nu_] ]. om1_ . Spinor[p2__] * Spinor[p3__]. DiracGamma[ LorentzIndex[mu_] ]. DiracGamma[ lva_[alpha_] ] . DiracGamma[ LorentzIndex[sigma_] ]. DiracGamma[ lvb_[beta_] ]. DiracGamma[ LorentzIndex[nu_] ]. om2_ . Spinor[p4__] ] :=(m 4 Spinor[p1] . DiracMatrix[mu].DiracGamma[lv[rho]]. DiracGamma[lv[beta]]. om1 . Spinor[p2] * Spinor[p3] . DiracMatrix[mu].DiracGamma[lva[alpha]]. DiracGamma[lvt[tau]]. om2 . Spinor[p4] ) /; ( (om1===DiracGamma[6])&& (om2===DiracGamma[7]) )|| ( (om1===DiracGamma[7])&& (om2===DiracGamma[6]) ); (* #################################################################### *) (* Main445 *) (* #################################################################### *) (* in case if no chiral projectors are present: *) sirlin2[m_. Spinor[p1__]. DiracGamma[ LorentzIndex[mu_] ]. DiracGamma[ lv_[rho_] ] . DiracGamma[ LorentzIndex[sigma_] ]. DiracGamma[ lvt_[tau_] ]. DiracGamma[ LorentzIndex[nu_] ]. Spinor[p2__] * Spinor[p3__]. DiracGamma[ LorentzIndex[mu_] ]. DiracGamma[ lva_[alpha_] ] . DiracGamma[ LorentzIndex[sigma_] ]. DiracGamma[ lvb_[beta_] ]. DiracGamma[ LorentzIndex[nu_] ]. Spinor[p4__] ] := Block[{tmp,re}, tmp[ome1_,ome2_]:= sirlin2[ m Spinor[p1]. DiracMatrix[mu].DiracGamma[lv[rho]].DiracMatrix[sigma]. DiracGamma[lvt[tau]].DiracMatrix[nu].DiracGamma[ome1] . Spinor[p2] * Spinor[p3].DiracMatrix[mu].DiracGamma[lva[alpha]]. DiracMatrix[sigma].DiracGamma[lvb[beta]].DiracMatrix[nu]. DiracGamma[ome2]. Spinor[p4] ]; re = tmp[6,6] + tmp[6,7] + tmp[7,6] + tmp[7,7]; re]; (* #################################################################### *) (* Main446 *) (* #################################################################### *) (* These are the ones calculated by FeynCalc *) sirlin2[ m_. Spinor[pi__] . x1___ . DiracGamma[ LorentzIndex[mu_] ] . DiracGamma[ LorentzIndex[nu_] ] . x2___ . Spinor[pj__] * Spinor[pk__] . x3___ . DiracGamma[ vm_[a_] ] . DiracGamma[ LorentzIndex[mu_] ] . DiracGamma[ LorentzIndex[nu_] ] . x4___ . Spinor[pl__] ] := Contract[ m ( 2*Spinor[pi] . x1 . x2 . Spinor[pj]* Spinor[pk] . x3 . DiracGamma[vm[a]] . x4 . Spinor[pl] + 2*Spinor[pk] . x3 . DiracGamma[LorentzIndex[al$mu]] . x4 . Spinor[pl]* Spinor[pi] . x1 . DiracGamma[vm[a]] . DiracGamma[LorentzIndex[al$mu]] . x2 . Spinor[pj] - 2*Spinor[pi] . x1 . DiracGamma[5] . x2 . Spinor[pj]* Spinor[pk] . x3 . DiracGamma[vm[a]] . DiracGamma[5] . x4 . Spinor[pl] + 2*Spinor[pk] . x3 . DiracGamma[LorentzIndex[al$mu]] . DiracGamma[5] . x4 .Spinor[pl]* Spinor[pi] . x1 . DiracGamma[vm[a]] . DiracGamma[LorentzIndex[al$mu]] . DiracGamma[5] . x2 . Spinor[pj] )]; sirlin2[ m_. * Spinor[Momentum[pi_], 0, fq___] . DiracGamma[Momentum[pk_]] . Spinor[Momentum[pj_], 0, fq___]* Spinor[Momentum[pl_], 0, fq___] . DiracGamma[Momentum[pj_]] . Spinor[Momentum[pk_], 0, fq___] ] := Contract[ m ( -((Spinor[Momentum[pi], 0, fq] . DiracGamma[Momentum[pl]] . Spinor[Momentum[pj], 0, fq]* Spinor[Momentum[pl], 0, fq] . DiracGamma[Momentum[pi]] . Spinor[Momentum[pk], 0, fq]*Pair[Momentum[pj], Momentum[pk]])/ Pair[Momentum[pi], Momentum[pl]]) + (Spinor[Momentum[pi], 0, fq] . DiracGamma[LorentzIndex[la]] . DiracGamma[5] . Spinor[Momentum[pj], 0, fq]* Spinor[Momentum[pl], 0, fq] . DiracGamma[LorentzIndex[la]] . DiracGamma[5] . Spinor[Momentum[pk], 0, fq]* (-(Pair[Momentum[pi], Momentum[pl]]* Pair[Momentum[pj], Momentum[pk]]) + Pair[Momentum[pi], Momentum[pk]]* Pair[Momentum[pj], Momentum[pl]] - Pair[Momentum[pi], Momentum[pj]]*Pair[Momentum[pk], Momentum[pl]])) /(2*Pair[Momentum[pi], Momentum[pl]]) + (Spinor[Momentum[pi], 0, fq] . DiracGamma[LorentzIndex[la]] . Spinor[Momentum[pj], 0, fq]* Spinor[Momentum[pl], 0, fq] . DiracGamma[LorentzIndex[la]] . Spinor[Momentum[pk], 0, fq]* (3*Pair[Momentum[pi], Momentum[pl]]* Pair[Momentum[pj], Momentum[pk]] + Pair[Momentum[pi], Momentum[pk]]*Pair[Momentum[pj], Momentum[pl]] - Pair[Momentum[pi], Momentum[pj]]*Pair[Momentum[pk], Momentum[pl]]))/ (2*Pair[Momentum[pi], Momentum[pl]]) ) ]; sirlin2[ m_. * Spinor[Momentum[pi_], 0, fq___] . DiracGamma[Momentum[pk_]] . Spinor[Momentum[pj_], 0, fq___]* Spinor[Momentum[pl_], 0, fq___] . DiracGamma[Momentum[pi_]] . Spinor[Momentum[pk_], 0, fq___] ] := Contract[ m ( -((Spinor[Momentum[pi], 0, fq] . DiracGamma[Momentum[pl]] . Spinor[Momentum[pj], 0, fq]* Spinor[Momentum[pl], 0, fq] . DiracGamma[Momentum[pj]] . Spinor[Momentum[pk], 0, fq]*Pair[Momentum[pi], Momentum[pk]])/ Pair[Momentum[pj], Momentum[pl]]) + (Spinor[Momentum[pi], 0, fq] . DiracGamma[LorentzIndex[la]] . Spinor[Momentum[pj], 0, fq]* Spinor[Momentum[pl], 0, fq] . DiracGamma[LorentzIndex[la]] . Spinor[Momentum[pk], 0, fq]* (Pair[Momentum[pi], Momentum[pl]]*Pair[Momentum[pj], Momentum[pk]] + 3*Pair[Momentum[pi], Momentum[pk]]* Pair[Momentum[pj], Momentum[pl]] - Pair[Momentum[pi], Momentum[pj]]*Pair[Momentum[pk], Momentum[pl]])) /(2*Pair[Momentum[pj], Momentum[pl]]) + (Spinor[Momentum[pi], 0, fq] . DiracGamma[LorentzIndex[la]] . DiracGamma[5] . Spinor[Momentum[pj], 0, fq]* Spinor[Momentum[pl], 0, fq] . DiracGamma[LorentzIndex[la]] . DiracGamma[5] . Spinor[Momentum[pk], 0, fq]* (-(Pair[Momentum[pi], Momentum[pl]]* Pair[Momentum[pj], Momentum[pk]]) + Pair[Momentum[pi], Momentum[pk]]*Pair[Momentum[pj], Momentum[pl]] + Pair[Momentum[pi], Momentum[pj]]*Pair[Momentum[pk], Momentum[pl]]))/ (2*Pair[Momentum[pj], Momentum[pl]]) ) ] /; First[ Spinor[Momentum[pi], 0, fq] . DiracGamma[Momentum[pk]]. Spinor[Momentum[pj], 0, fq]* Spinor[Momentum[pl], 0, fq] . DiracGamma[Momentum[pi]] . Spinor[Momentum[pk], 0, fq]]=== Spinor[Momentum[pi], 0, fq] . DiracGamma[Momentum[pk]]. Spinor[Momentum[pj], 0, fq]; sirlin2[ m_. * Spinor[Momentum[pi_], 0, fq___] . DiracGamma[Momentum[pk_]] . DiracGamma[5] . Spinor[Momentum[pj_], 0, fq___]* Spinor[Momentum[pl_], 0, fq___] . DiracGamma[Momentum[pj_]] . DiracGamma[5] . Spinor[Momentum[pk_], 0, fq___] ] := Contract[ m ( Spinor[Momentum[pi], 0, fq] . DiracGamma[Momentum[pk]] . Spinor[Momentum[pj], 0, fq]* Spinor[Momentum[pl], 0, fq] . DiracGamma[Momentum[pj]] . Spinor[Momentum[pk], 0, fq] - Spinor[Momentum[pi], 0, fq] . DiracGamma[LorentzIndex[la]] . Spinor[Momentum[pj], 0, fq]* Spinor[Momentum[pl], 0, fq] . DiracGamma[LorentzIndex[la]] . Spinor[Momentum[pk], 0, fq]*Pair[Momentum[pj], Momentum[pk]] + Spinor[Momentum[pi], 0, fq] . DiracGamma[LorentzIndex[la]] . DiracGamma[5] . Spinor[Momentum[pj], 0, fq]* Spinor[Momentum[pl], 0, fq] . DiracGamma[LorentzIndex[la]] . DiracGamma[5] . Spinor[Momentum[pk], 0, fq]* Pair[Momentum[pj], Momentum[pk]] ) ]; sirlin2[ m_. * Spinor[Momentum[pi_], 0, fq___] . DiracGamma[Momentum[pk_]] . DiracGamma[5] . Spinor[Momentum[pj_], 0, fq___]* Spinor[Momentum[pl_], 0,fq___]. DiracGamma[Momentum[pi_]] . DiracGamma[5] . Spinor[Momentum[pk_], 0, fq___] ] := Contract[ m ( -(Spinor[Momentum[pi], 0, fq] . DiracGamma[Momentum[pk]] . Spinor[Momentum[pj], 0, fq]* Spinor[Momentum[pl], 0, fq] . DiracGamma[Momentum[pi]] . Spinor[Momentum[pk], 0, fq]) + Spinor[Momentum[pi], 0, fq] . DiracGamma[LorentzIndex[la]] . Spinor[Momentum[pj], 0, fq]* Spinor[Momentum[pl], 0, fq] . DiracGamma[LorentzIndex[la]] . Spinor[Momentum[pk], 0, fq]*Pair[Momentum[pi], Momentum[pk]] + Spinor[Momentum[pi], 0, fq] . DiracGamma[LorentzIndex[la]] . DiracGamma[5] . Spinor[Momentum[pj], 0, fq]* Spinor[Momentum[pl], 0, fq] . DiracGamma[LorentzIndex[la]] . DiracGamma[5] . Spinor[Momentum[pk], 0, fq]* Pair[Momentum[pi], Momentum[pk]] ) ]; sirlin2[ m_. * Spinor[Momentum[pi_], 0, fq___] . DiracGamma[Momentum[pl_]] . DiracGamma[5] . Spinor[Momentum[pj_], 0, fq___]* Spinor[Momentum[pl_], 0, fq___] . DiracGamma[Momentum[pj_]] . DiracGamma[5] . Spinor[Momentum[pk_], 0, fq___] ] := Contract[ m ( -(Spinor[Momentum[pi], 0, fq] . DiracGamma[Momentum[pl]] . Spinor[Momentum[pj], 0, fq]* Spinor[Momentum[pl], 0, fq] . DiracGamma[Momentum[pj]] . Spinor[Momentum[pk], 0, fq]) + Spinor[Momentum[pi], 0, fq] . DiracGamma[LorentzIndex[la]] . Spinor[Momentum[pj], 0, fq]* Spinor[Momentum[pl], 0, fq] . DiracGamma[LorentzIndex[la]] . Spinor[Momentum[pk], 0, fq]*Pair[Momentum[pj], Momentum[pl]] + Spinor[Momentum[pi], 0, fq] . DiracGamma[LorentzIndex[la]] . DiracGamma[5] . Spinor[Momentum[pj], 0, fq]* Spinor[Momentum[pl], 0, fq] . DiracGamma[LorentzIndex[la]] . DiracGamma[5] . Spinor[Momentum[pk], 0, fq]* Pair[Momentum[pj], Momentum[pl]] ) ]; (* #################################################################### *) (* Main447 *) (* ###############################