Skip to content

Commit

Permalink
Vastly improved MomentumCombine to have more control over the way
Browse files Browse the repository at this point in the history
expressions get combined.
  • Loading branch information
vsht committed Aug 1, 2024
1 parent b16e880 commit 61cf2ab
Show file tree
Hide file tree
Showing 4 changed files with 270 additions and 150 deletions.
118 changes: 0 additions & 118 deletions FeynCalc/Documentation/Markdown/MomentumCombine.md

This file was deleted.

59 changes: 59 additions & 0 deletions FeynCalc/Documentation/Mathematica/Lorentz/MomentumCombine.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,31 @@

(* ::Text:: *)
(*`MomentumCombine[expr]` is the inverse operation to `MomentumExpand` and `ExpandScalarProduct`. `MomentumCombine` combines also `Pair`s.*)
(*Notice, that `MomentumCombine` cannot complete squares. It can, however, bring expressions containing scalar products to a suitable form that allows for a square completion using other means.*)


(* ::Text:: *)
(*This function offers multiple options.*)


(* ::Text:: *)
(*The option `NumberQ` (default is `True`) specifies whether one should only merge quantities with numerical prefactors or not. Setting it to `False` allows for symbolic prefactors.*)


(* ::Text:: *)
(*Setting the option `"Quadratic"` to `False` (default is `True`) effectively means that momenta squared will not be combined with anything else.*)


(* ::Text:: *)
(*With the option `"ExcludeScalarProducts"` we can ensure that scalar products containing any of the momenta listed are not merged with anything else. So `a.x + a.y` can be merged either if `a` contains no such momenta, or if both `x` and `y` are free of them.*)


(* ::Text:: *)
(*The option `Except` forbids merging the listed momenta with anything else. It is much more restrictive than `"ExcludeScalarProducts"` that allows for merging terms linear in the listed momenta.*)


(* ::Text:: *)
(*The option `Select` allows for gathering all terms linear in the given momenta before applying any other combining rules.*)


(* ::Subsection:: *)
Expand Down Expand Up @@ -93,3 +118,37 @@


MomentumCombine[ex,NumberQ->False,"Quadratic"->False,Except->{k,l}]


(* ::Text:: *)
(*Suppose that we have an expression that can be written as a square. To achieve the desired combination of momenta we need to*)


(DataType[#,FCVariable]=True)&/@{gkin,meta,u0b};


ex=SPD[k1,k1]-2 SPD[k1,k2]+2 gkin meta SPD[k1,n]-2 gkin meta u0b SPD[k1,n]-meta u0b SPD[k1,nb]+
SPD[k2,k2]-2 gkin meta SPD[k2,n]+2 gkin meta u0b SPD[k2,n]+meta u0b SPD[k2,nb]


(* ::Text:: *)
(*The naive application of `MomentumCombine` doesn't return anything useful*)


MomentumCombine[ex]


(* ::Text:: *)
(*Here we actually want to gather terms linear in `k1` and `k2`first before trying to combine them together. To that aim we can use the option `Select`.*)
(*Employing the options `"Quadratic"` and `"ExcludeScalarProducts"` we can prevent `k1` and `k2` from getting combined with anything containing *)
(*those momenta. Furthermore, we enable symbolical prefactor by setting `NumberQ` to false*)


MomentumCombine[ex,Select->{k1,k2},"Quadratic"->False,"ExcludeScalarProducts"->{k1,k2},NumberQ->False]


(* ::Text:: *)
(*This result looks very good, but `k1` and `k2` were not combined because they are contracted to long linear combinations of 4-momenta that were not properly factorized. The option `Factoring` solves this issue*)


res=MomentumCombine[ex,Select->{k1,k2},"Quadratic"->False,"ExcludeScalarProducts"->{k1,k2},NumberQ->False,Factoring->Factor2]
Loading

0 comments on commit 61cf2ab

Please sign in to comment.