vermaseren / form

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

trace4 and dollar variables #273

Open vsht opened 6 years ago

vsht commented 6 years ago

I'm wondering why trace4 apparently cannot work with dollar variables. For example

off statistics;
Autodeclare indices lor;
Autodeclare vectors p;
CFunction dtr,dtrcurrent;

L expr1 = dtr(lor1,lor2,p3,p4)*dtr(p5,p6,p7,p8);

$diracTraceCounter = 20;

repeat;
$diracTraceCounter = $diracTraceCounter+1;

id once dtr(?lor1) = dtrcurrent(?lor1);

id dtrcurrent(?lor1) = g_($diracTraceCounter,?lor1);

endrepeat;

do $i = 20,$diracTraceCounter;
  trace4, $i;
enddo;

print expr1;

.end

yields


$i does not have an index value in trace statement in module 1
$i does not have an index value in trace statement in module 1
$i does not have an index value in trace statement in module 1
$i does not have an index value in trace statement in module 1

   expr1 =
      g_(21,lor1,lor2,p3,p4)*g_(22,p5,p6,p7,p8);

A possible workaround would be to use the preprocessor with something like

#do j = 20,100;
  trace4 `j';
#enddo 

It seems that calling trace4 for non-existing spin line indices does not cost any performance. Still, it is not so clear to me, why this cannot be done using dollar variables during runtime. I checked the manual, but the relevant chapters on trace4, tracen or the Dirac algebra do not mention dollar variables at all.

Cheers, Vladyslav

vermaseren commented 6 years ago

Hi,

In the cases I had checked in the past it worked as in repeat; id,once,g(n?$n,m1?) = g(n,m1); trace4,$n; endrepeat; In your case the $ was seen as a number and not as an index. I have repaired that.

Cheers

Jos

On 21 Mar 2018, at 07:35, Vladyslav Shtabovenko notifications@github.com wrote:

I'm wondering why trace4 apparently cannot work with dollar variables. For example

off statistics; Autodeclare indices lor; Autodeclare vectors p; CFunction dtr,dtrcurrent;

L expr1 = dtr(lor1,lor2,p3,p4)*dtr(p5,p6,p7,p8);

$diracTraceCounter = 20;

repeat; $diracTraceCounter = $diracTraceCounter+1;

id once dtr(?lor1) = dtrcurrent(?lor1);

id dtrcurrent(?lor1) = g_($diracTraceCounter,?lor1);

endrepeat;

do $i = 20,$diracTraceCounter; trace4, $i; enddo;

print expr1;

.end yields

$i does not have an index value in trace statement in module 1 $i does not have an index value in trace statement in module 1 $i does not have an index value in trace statement in module 1 $i does not have an index value in trace statement in module 1

expr1 = g(21,lor1,lor2,p3,p4)*g(22,p5,p6,p7,p8); A possible workaround would be to use the preprocessor with something like

do j = 20,100;

trace4 `j';

enddo

It seems that calling trace4 for non-existing spin line indices does not cost any performance. Still, it is not so clear to me, why this cannot be done using dollar variables during runtime. I checked the manual, but the relevant chapters on trace4, tracen or the Dirac algebra do not mention dollar variables at all.

Cheers, Vladyslav

— 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/273, or mute the thread https://github.com/notifications/unsubscribe-auth/AFLxEr0US6Q2jRinOFOOP1k1OR9wevGZks5tgfSVgaJpZM4SzEcI.

vsht commented 6 years ago

Hi Jos,

thanks for the quick reply. I recompiled FORM from the master branch, but there still seems to be an issue. My original example now returns


expr1 =
      16*d_(lor1,lor2)*p3.p4*p5.p6*p7.p8 - 16*d_(lor1,lor2)*p3.p4*p5.p7*p6.p8
       + 16*d_(lor1,lor2)*p3.p4*p5.p8*p6.p7 - 4*g_(22,p5,p6,p7,p8)*p3(lor1)*
      p4(lor2) + 4*g_(22,p5,p6,p7,p8)*p3(lor2)*p4(lor1);

i.e. somehow the trace is still not evaluated. Replacing

do $i = 20,$diracTraceCounter;
  trace4, $i;
enddo;

with


do $i = 20,23;
  trace4, $i;
enddo;

works as expected, though. From

do $i = 20,$diracTraceCounter;
  multiply foo($i);
enddo;

I can see that the value of $i is correctly propagated into the loop, so I'm not sure why trace4 still does not want to evaluate.

tueda commented 6 years ago

To me, the replacement with

do $i = 20,23;
  trace4, $i;
enddo;

doesn't work completely, but

do $i = 20,23;
  trace4, $i;
enddo;
do $i = 20,23;
  trace4, $i;
enddo;

somehow evaluates all the (two, in this case) traces.

vsht commented 6 years ago

Hi Takahiro,

I agree with you findings. The first snippet indeed evaluates only a part of the traces, but not everything. Apparently I overlooked this fact two days ago. The second snippet gets everything evaluated, but this looks more like some kind of a side effect.

Cheers, Vladyslav

vermaseren commented 6 years ago

Hi,

The problem is not with the Trace4,$i; Have a look at this:

do $i = 20,$diracTraceCounter;
  trace4, $i;
  Print +f "<%$> %t",$i;
enddo;

print expr1;

.end
<20> + g_(21,lor1,lor2,p3,p4)*g_(22,p5,p6,p7,p8) <21> + 4*g_(22,p5,p6,p7,p8)*d_(lor1,lor2)*p3.p4 <22> + 16*d_(lor1,lor2)*p3.p4*p5.p6*p7.p8 <23> + 16*d_(lor1,lor2)*p3.p4*p5.p6*p7.p8 <24> - 16*d_(lor1,lor2)*p3.p4*p5.p7*p6.p8 <25> + 16*d_(lor1,lor2)*p3.p4*p5.p8*p6.p7 <26> - 4*g_(22,p5,p6,p7,p8)*p3(lor1)*p4(lor2) <27> + 4*g_(22,p5,p6,p7,p8)*p3(lor2)*p4(lor1) Somehow the do-loop is making a mess of things. I’ll have to think this over….. Jos > On 23 Mar 2018, at 04:56, Vladyslav Shtabovenko wrote: > > Hi Takahiro, > > I agree with you findings. The first snippet indeed evaluates only a part of the traces, but not everything. Apparently I overlooked this fact two days ago. The second snippet gets everything evaluated, but this looks more like some kind of a side effect. > > Cheers, > Vladyslav > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub , or mute the thread . >