Skip to content

Commit

Permalink
make sure the loop factor is factored out
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Voigt authored and Alexander Voigt committed Dec 2, 2015
1 parent f675a3f commit a024111
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion meta/BetaFunction.m
Expand Up @@ -106,9 +106,20 @@
]
];

FactorOutLoopFactor[expr_] :=
Module[{i, prefactors = {CConversion`oneOver16PiSqr, CConversion`twoLoop,
CConversion`threeLoop, CConversion`oneOver16PiSqr^4}},
For[i = 1, i <= Length[prefactors], i++,
If[Coefficient[expr, prefactors[[i]]] =!= 0,
Return[Simplify[prefactors[[i]] Expand[expr / prefactors[[i]]]]];
];
];
expr
];

(* split expression into sub-expressions of given maximum size *)
SplitExpression[expr_, size_Integer] :=
Factor /@ (Plus @@@ Utils`SplitList[ToList[expr, Plus], size]);
FactorOutLoopFactor /@ (Plus @@@ Utils`SplitList[ToList[expr, Plus], size]);

NeedToSplitExpression[expr_, threshold_Integer] :=
Length[ToList[expr, Plus]] > threshold;
Expand Down

0 comments on commit a024111

Please sign in to comment.