vermaseren / form

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

Dollar vector #568

Open veretin opened 2 weeks ago

veretin commented 2 weeks ago

Hello, I have problem with the following code:

v k,k1,k2, newvector;
c A,B,C;

g f = A(k1)*C(3*k1.k1 + 5*k1.k2 + 7*k2.k2);

* set $k                                                                                                                                
id A(k?$k) = A(k);

  argument C;
  print "in term %t we have $k = %$", $k;
  id $k = newvector;*  <-- this substitution is ignored!
*  id $k.$k = 0;*  <-- this gives error                                                                                                 
*  id $k.k2 = 0;*  <-- this gives error too                                                                                             
  endargument;

print+s;
.end

The substitution in "id $k = newvector;" is ignored. By the way, the same code with symbols works.

Best regards, OVeretin

jodavies commented 2 weeks ago

As a quick workaround, does it suffice to use multiply replace_($k,newvector); inside the argument environment?

veretin commented 2 weeks ago

No, I want to do more complicated things like

id $k.$k^j? = j * $k.$k^(j-1) * $k.V;
jodavies commented 2 weeks ago

In that case one could hopefully do something like:

multiply replace_($k,tmp);
id tmp.tmp^j? = ... ;
multiply replace_(tmp,$k);

but I will take a look at the direct dollar-var version when I get a chance.

tueda commented 2 weeks ago

Another workaround:

id p.p^j? * replace_(p,$k) = j * p.p^(j-1) * p.V * replace_(p,$k);

where p is a vector.