vermaseren / form

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

The current color.h is broken #414

Closed grozin closed 1 year ago

grozin commented 1 year ago

With color.h from https://www.nikhef.nl/~form/maindir/packages/color/color.html, the following program

#include color.h
AutoDeclare Index i,j,k;
CFunction acc;
Symbol x;
.global
G Q1 = T(i1,i2,j1)*T(i2,i3,j2)*T(i3,i4,j3)*T(i4,i5,j4)*T(i5,i1,j5)
  *T(k1,k2,j1)*T(k2,k3,j2)*T(k3,k4,j3)*T(k4,k5,j4)*T(k5,k1,j5);
G Q2 = T(i1,i2,j5)*T(i2,i3,j4)*T(i3,i4,j3)*T(i4,i5,j2)*T(i5,i1,j1)
  *T(k1,k2,j1)*T(k2,k3,j2)*T(k3,k4,j3)*T(k4,k5,j4)*T(k5,k1,j5);
Sum i1,...,i5,j1,...,j5,k1,...,k5;
.sort
#call color
#call SORT(tloop-1)
#call adjoint
Print +f +s;
#call SORT(tloop-2)
Print +f +s;
.sort
#call simpli
id      acc(x?) = x;
Print +f +s;
.end

produces

   Q1 =
       - 5/144*NA*I2R^2*cA^3
       + 11/48*d33(cOlpR1,cOlpR2)*cA^2
       - 5/6*d44(cOlpR1,cOlpR2)*cA
       + 1/6*d44(cOlpR1,cOlpA1)*I2R
       + d55(cOlpR1,cOlpR2)
      ;

   Q2 =
       + 1/48*NA*I2R^2*cA^3
       + 1/72*d_(N1_?,N2_?)*I2R^2*cA^3
       + 1/8*d33(cOlpR1,cOlpR2)*cA^2
       + 5/54*d33(cOlpR1,cOlpR2)*d_(N1_?,N2_?)*NA^-1*cA^2
       + 1/4*d44(cOlpR1,cOlpR2)*cA
       + 2/3*d44(cOlpR1,cOlpR2)*d_(N1_?,N2_?)*NA^-1*cA
       + d55(cOlpR1,cOlpR2)*d_(N1_?,N2_?)*NA^-1
       - 1/6*f(cOlpR1,N1_?,N2_?)*f(cOlpR1,N1_?,N3_?)*f(cOlpR1,N2_?,N4_?)*f(
      cOlpR1,N3_?,N5_?)*I2R
      ;

Q1 is OK, but Q2 is not. Kostja Chetyrkin has sent an older version of color.h to me, with it the result is

   Q1 =
       - 5/144*NA*I2R^2*cA^3
       + 11/48*d33(cOlpR1,cOlpR2)*cA^2
       - 5/6*d44(cOlpR1,cOlpR2)*cA
       + 1/6*d44(cOlpR1,cOlpA1)*I2R
       + d55(cOlpR1,cOlpR2)
      ;

   Q2 =
       + 5/144*NA*I2R^2*cA^3
       + 11/48*d33(cOlpR1,cOlpR2)*cA^2
       + 5/6*d44(cOlpR1,cOlpR2)*cA
       - 1/6*d44(cOlpR1,cOlpA1)*I2R
       + d55(cOlpR1,cOlpR2)
      ;

Q2 is fine, too. color_old.txt

benruijl commented 1 year ago

This color.h has an issue with the dimensions, which are set to NA by default. cOli, needs to be set to NR.

grozin commented 1 year ago

Can somebody replace color.h at https://www.nikhef.nl/~form/maindir/packages/color/color.html (including color.h inside color.tar.gz) by a working version? Physicists who want to use the package color, naturally, get to this web page, download color.h (or color.tar.gz), and find that it does not work.

apik commented 1 year ago

The following code

#-
#include color.h
* fundamental
I <i1=NR>,...,<i5=NR>;
I <k1=NR>,...,<k5=NR>;
* adjoint
I <j1=NA>,...,<j5=NA>;

L Q1 = T(i1,i2,j1)*T(i2,i3,j2)*T(i3,i4,j3)*T(i4,i5,j4)*T(i5,i1,j5)
  *T(k1,k2,j1)*T(k2,k3,j2)*T(k3,k4,j3)*T(k4,k5,j4)*T(k5,k1,j5);
L Q2 = T(i1,i2,j5)*T(i2,i3,j4)*T(i3,i4,j3)*T(i4,i5,j2)*T(i5,i1,j1)
  *T(k1,k2,j1)*T(k2,k3,j2)*T(k3,k4,j3)*T(k4,k5,j4)*T(k5,k1,j5);

#call docolor
Print +f +s;
.end

produces expected result using color.h without any modifications:

   Q1 =
       - 5/144*NA*I2R^2*cA^3
       + 11/48*d33(cOlpR1,cOlpR2)*cA^2
       - 5/6*d44(cOlpR1,cOlpR2)*cA
       + 1/6*d44(cOlpR1,cOlpA1)*I2R
       + d55(cOlpR1,cOlpR2)
      ;

   Q2 =
       + 5/144*NA*I2R^2*cA^3
       + 11/48*d33(cOlpR1,cOlpR2)*cA^2
       + 5/6*d44(cOlpR1,cOlpR2)*cA
       - 1/6*d44(cOlpR1,cOlpA1)*I2R
       + d55(cOlpR1,cOlpR2)
      ;
grozin commented 1 year ago

You are right. I copied the code from tloop.frm from color.tar.gz from Vermaseren's site. Dimensions of indices are not declared there, therefore, I thought that it is unnecessary. And the older version of color.h works without declaring dimensions.

tueda commented 1 year ago

Actually, for this case, it seems that just removing the sum statement leads to the correct result:

#include- color.h
S ALARM;  * don't care the dimensions
Auto I i=ALARM,j=ALARM,k=ALARM;
G Q1 = T(i1,i2,j1)*T(i2,i3,j2)*T(i3,i4,j3)*T(i4,i5,j4)*T(i5,i1,j5)
  *T(k1,k2,j1)*T(k2,k3,j2)*T(k3,k4,j3)*T(k4,k5,j4)*T(k5,k1,j5);
G Q2 = T(i1,i2,j5)*T(i2,i3,j4)*T(i3,i4,j3)*T(i4,i5,j2)*T(i5,i1,j1)
  *T(k1,k2,j1)*T(k2,k3,j2)*T(k3,k4,j3)*T(k4,k5,j4)*T(k5,k1,j5);
.sort
#call docolor
Print +f +s;
.end

(I am not sure whether the dimensions need to be declared in general; color.h may handle such indices appearing in T adequately.)

Maybe color.h is OK but the example code (tloop.frm) is outdated?

grozin commented 1 year ago

tloop.frm is a set of tests; it is, as far as I know, the only place which allows a physicist to leart how to use color.h. And it contains Sum. Maybe, tloop.frm should be replaced by a better tests file and/or a manual/instruction?