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

dummy_ function? #143

Open tueda opened 7 years ago

tueda commented 7 years ago

I don't know (and actually I can't find) what happens to the dummy_ function in the normalization process, but it seems like

id dummy_(?a) = 1;

Is it safe to assume the above rule? The manual says just

For internal use only.

But it would be benefitable to have a function immediately normalized to 1:

FORM 4.1 (Nov 11 2016, v4.1-20131025-262-g6b9e3da) 64-bits  Run: Wed Nov 16 16:36:14 2016
    S x1,...,x99;
    CF f,f1,f2;
    L F = f(x1,...,x20);
    id f(?a) = distrib_(1,10,f1,f2,?a);
    id f2(?a) = 1;
    .end

Time =       0.15 sec    Generated terms =      92592
               F       1 Terms left      =      92592
                         Bytes used      =    2827408

Time =       0.31 sec    Generated terms =     184756
               F       1 Terms left      =     184756
                         Bytes used      =    5777920

Time =       0.33 sec    Generated terms =     184756
               F         Terms in output =     184756
                         Bytes used      =    5777832
  0.33 sec out of 0.34 sec

vs.

FORM 4.1 (Nov 11 2016, v4.1-20131025-262-g6b9e3da) 64-bits  Run: Wed Nov 16 16:38:50 2016
    S x1,...,x99;
    CF f,f1,f2;
    L F = f(x1,...,x20);
    id f(?a) = distrib_(1,10,f1,dummy_,?a);
    .end

Time =       0.09 sec    Generated terms =      92592
               F       1 Terms left      =      92592
                         Bytes used      =    2827408

Time =       0.18 sec    Generated terms =     184756
               F       1 Terms left      =     184756
                         Bytes used      =    5777920

Time =       0.20 sec    Generated terms =     184756
               F         Terms in output =     184756
                         Bytes used      =    5777832
  0.20 sec out of 0.20 sec
tueda commented 6 years ago

Another useful idiom using the (still mysterious) dummy_ function:

**
* Drop all coefficient objects except the given ones.
*
#procedure DropExcept(?a)
  antiputinside dummy_,`?a';
#endprocedure

CF f,g;
S x,y;
L F = 2 * f(1,2,3) * g(4,5) * x^3 * y^2;
#call DropExcept(f,x)
P;
.end

giving

   F =
      f(1,2,3)*x^3;