Open Aradzh opened 3 years ago
I think the root of the problem is a known issue of pattern matching. See also, for example,
To understand the problem, let's consider the following small example:
V p1,p2,v1,v2,t;
CF f;
L F = p1.t^2 * p2.t;
id v1?.t^2 * v2?.t = f(v1,v2);
P;
.end
which gives
F =
f(p1,p2);
because the term in the expression F
matches with the pattern given as the left-hand side of the id
statement.
Now, if I change the pattern a bit,
V p1,p2,v1,v2,t;
CF f;
L F = p1.t^2 * p2.t;
id v1?.t * v2?.t^2 = f(v1,v2); * <-- LHS changed
P;
.end
then the term doesn't match with the pattern, so leads to
F =
p1.t^2*p2.t;
You may think v1?.t^2 * v2?.t
and v1?.t * v2?.t^2
are the same (up to the exchange of the wildcards v1
and v2
). That should be true, but unfortunately FORM doesn't work with the latter in this case.
Note that the declaration order of vectors affects how terms (even with wildcards) are normalized (effectively, v1?.t^2 * v2?.t
or v1?.t * v2?.t^2
).
A workaround is to put elements that possibley match into function arguments:
V p1,p2,v1,v2,t;
CF f;
CF tmp(symmetric);
L F = p1.t^2 * p2.t;
id p1?.p2? = tmp(p1,p2);
id tmp(v1?,t) * tmp(v2?,t)^2 = f(v1,v2);
P;
.end
because a backtracking algorithm in pattern matching for products of functions is implemented in FORM. ToTensor
may also be useful to put vectors into functions.
Thanks for description and workaround.
In my form program I try to realize the id change of some vector combinations
the result was as expected
However in my original code the definitions section is
and leads to wrong result (without id substitution )
if I change the order of lines in definition section - put four line to the first place
result again becomes correct. Please find attached files in TstJp.zip - TstJp1.frm - correct result, TstJp2.frm - incorrect result, TstJp2a.frm - two lines interchanged in TstJp2.frm and correct result TstJp.zip