vermaseren / form

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

multiply replace_ and e_ #228

Open vsht opened 7 years ago

vsht commented 7 years ago

As explained by Jos in Issue #206, it is not possible to use something like Multiply replace_(e_,eps) when working with the epsilon tensor. In the following code

F eps;
Auto V v;

L expr = 2*e_(v1,v2,v3,v4);
multiply replace_(e_,eps);
print;

.end

nothing happens, i.e. the replacement rule is simply not matched. This is fine. However, the reverse replacement seems to produce a much more dangerous result

F eps;
Auto V v;
off statistics;
L expr = 2*eps(v1,v2,v3,v4);
multiply replace_(eps,e_);
print;
.end

Here we get

   expr = 0;

which might constitute a serious pitfall for new users who are not aware of the special properties of e_ in FORM. I would suggest to display some sort of a warning message once e_appears in replace_, since such statements will most likely lead to problems.

tueda commented 7 years ago

Probably what you need (or you have already found) is

id eps(?a) = e_(?a);

and for its reverse

Auto I mu;
#do i=1,9
  id e_(<mu1?>,...,<mu`i'?>) = eps(<mu1>,...,<mu`i'>);
#enddo

though they are not symmetric/orthogonal/cool, I agree.

vsht commented 7 years ago

Well, I'm of course aware of the trick with

id eps(?a) = e_(?a);

and I'm also not complaining about

multiply replace_(e_,eps);

not working. What I wanted to point out is that the behavior of

multiply replace_(eps,e_);

seems very dangerous to me. If it just would do nothing like multiply replace_(e_,eps) or (better) generate an error, that would be fine.

But currently it silently sets all e_ tensors to zero, which is at least strange and may easily lead to wrong results that are very difficult to debug.