vermaseren / form

The FORM project for symbolic manipulation of very big expressions
GNU General Public License v3.0
982 stars 118 forks source link

Substitute vector in inverse of scalar product #419

Open fetchinson opened 1 year ago

fetchinson commented 1 year ago

I'd like to substitute p1 + p2 in place of p where every variable is a vector. Seems simple enough and if my expression is for example a scalar product there is no problem:

CFunction V;
Vector p, p1, p2;
Local expr = V(p);
id V(p?) = (p.p);
id p = p1+p2;
.sort
P +s;
.end

This gives the expected result:

   expr =
       + p1.p1
       + 2*p1.p2
       + p2.p2
      ;

However, if my expression is the inverse of the scalar product,

CFunction V;
Vector p, p1, p2;
Local expr = V(p);
id V(p?) = 1/(p.p);
id p = p1+p2;
.sort
P +s;
.end

no substitution takes place and the result is the original expression:

   expr =
       + p.p^-1
      ;

Why does FORM behave this way? And more importantly, how can I do the actual substitution?

jodavies commented 1 year ago

You can make this replacement with Multiply replace_(p,p1+p2);, however the resulting expression can be a bit awkward to work with in terms of pattern matching. You can rename the implied denominator function with Denominators den;, for eg, to make further manipulations easier.

fetchinson commented 1 year ago

Thanks, Multipy replace_(....) seems to do what I'd like to do.

But I can't help asking how one would work with the most basic feynman diagrams if denominators are so peculiar? Various denominators show up all the time, what is the preferred way of working with them in FORM?

tueda commented 1 year ago

But I can't help asking how one would work with the most basic feynman diagrams if denominators are so peculiar? Various denominators show up all the time, what is the preferred way of working with them in FORM?

I think people expand dot products in numerators but don't like to expand those in denominators, because in many cases the latter does not lead to any further simplification.

If $p$ must be temporary and should be replaced with $(p_1+p_2)$, I would introduce a vector [p1+p2]:

V p,[p1+p2];
L F = 1/p.p;
multiply replace_(p,[p1+p2]);
P;
.end

or maybe a symbol for each propagator, say d1 (or s or s12, as you like):

V p;
S d1;
L F = 1/p.p;
id 1/p.p = 1/d1;
P;
.end

which would be easier to handle for following operations, for example, partial fraction decomposition.

vermaseren commented 1 year ago

Working with the built in denominator facility is usually not a good idea. To make it act intelligently on its own is a: not easy, b: not unique. The ’standard solution is to define a function den and decide that for all practical purposes den(x) behaves like 1/x. This means for instance that if you have x1^2den(x1+x2+x3) and you would like to simplify this wrt x1 you use: Splitarg (x1),den; Print “ %t”; Just to show what that does. repeat id x1den(x?,x1) = 1-xden(x,x1); Print; .end This could be useful when you want to integrate in x1. Similarly you can split fractions. This is shown in the third lecture of the Form course that you can find in nikhef.nl/~form http://nikhef.nl/~form although at the moment that lecture is off line because I am currently teaching that course and do not want the lectures to appear before the days of the actual class. You will find it on 15-Nov. Although the examples are all for symbols, it also works well for dotproducts and lots of other things.

On 11 Nov 2022, at 05:20, Takahiro Ueda @.***> wrote:

But I can't help asking how one would work with the most basic feynman diagrams if denominators are so peculiar? Various denominators show up all the time, what is the preferred way of working with them in FORM?

I think people expand dot products in numerators but don't like to expand those in denominators, because in many cases the latter does not lead to any further simplification.

If $p$ must be temporary and should be replaced with $(p_1+p_2)$, I would introduce a vector [p1+p2]:

V p,[p1+p2]; L F = 1/p.p; multiply replace_(p,[p1+p2]); P; .end or maybe a symbol for each propagator, say d1 (or s or s12, as you like):

V p; S d1; L F = 1/p.p; id 1/p.p = 1/d1; P; .end which would be easier to handle for following operations, for example, partial fraction decomposition.

— Reply to this email directly, view it on GitHub https://github.com/vermaseren/form/issues/419#issuecomment-1311211601, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJPCEVOA24M7JIIZFGAPODWHXCPVANCNFSM6AAAAAAR4X7ZSU. You are receiving this because you are subscribed to this thread.

fetchinson commented 1 year ago

Fantastic, thanks very much for the explanation!