vermaseren / form

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

id_ function for vectors #155

Open tueda opened 7 years ago

tueda commented 7 years ago

It would be nice to extend the functionality of id_ also for vectors.

V p1,p2,p3,p4;
L F = p1.p2 * id_(p1,p3);
P;
.end

currently gives

FORM 4.1 (Nov 29 2016, v4.1-20131025-272-gb993ca7) 64-bits  Run: Mon Dec  5 13:59:58 2016

   F =
      id_(p1,p3)*p1.p2;

This is an easy way to dynamically replace dot products in numerators (including squared ones) while untouching denominators. (replace_ affects on both numerators and denominators).

tueda commented 6 years ago

Might be nice also for functions as

CF f(s);
L F = f(1,2,3);
multiply id_(f,dummy_);
* id f(?a) = 1;                 * compile-time error
* multiply replace_(f,dummy_);  * dangerous, not only the ground level
P;
.end

though I don't know the exact meaning of dummy_ yet (#143).

tueda commented 6 years ago

Better if it works also for indices.

vermaseren commented 6 years ago

And how would you do that. For functions id f = dummy; is different from id f(?a) = dummy(?a); Because id is a function Multiply id(f(?a),dummy(?a)); Cannot work either, because ?a is not defined in a LHS. In general the id cannot work with wiuldcards in the same way as the id statement can. With normal wildcard variables one could envision Multiply id(x,y,f(x,y),dummy(x,y)); to mean that x and y should be seen as wildcards in the LHS that will be generated, but this still excludes the use of ?a type wildcards. Anyway, in your example f is a symmetric function and f(?a) cannot work either in the current pattern matcher.

Suggestions?

Jos

On 24 Nov 2017, at 18:12, Takahiro Ueda notifications@github.com wrote:

Better if it works also for indices.

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

tueda commented 6 years ago

You are right for id_ for functions. Actually what one needs (and may expect for id) is `replace` with specifying the level where the substitution is performed.