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

$args in gcd_ and more? #196

Open tueda opened 7 years ago

tueda commented 7 years ago

This is rather related to #191, but it may be a more general problem, so I made a separate issue.

FORM 4.1 (Jun  8 2017, v4.1-20131025-352-g7cf7c42) 64-bits  Run: Thu Jun  8 23:52:41 2017
    CF f;
    #$t = f(0,0);
    #inside $t;
      id f(?a$a) = 1;
    #endinside;
    #$r = gcd_($a);
Trying to convert a $ with an argument field into an expression
Program terminating at test.frm Line 6 -->

I remember a similar issue about expansion of argument fields existed for distrib_ #186. Should they be treated in more general way, or should each case for each buildin function be implemented? (Or it's just abusing $-variables?)

vermaseren commented 7 years ago

It is indeed unrelated. This will probably also go wrong with div_ etc. It needs some thinking first.

Jos

On 8 jun. 2017, at 23:58, Takahiro Ueda notifications@github.com wrote:

This is rather related to #191 https://github.com/vermaseren/form/issues/191, but it may be a more general problem, so I made a separate issue.

FORM 4.1 (Jun 8 2017, v4.1-20131025-352-g7cf7c42) 64-bits Run: Thu Jun 8 23:52:41 2017 CF f;

$t = f(0,0);

#inside $t;
  id f(?a$a) = 1;
#endinside;
#$r = gcd_($a);

Trying to convert a $ with an argument field into an expression Program terminating at test.frm Line 6 --> I remember a similar issue about expansion of argument fields existed for distrib_ #186 https://github.com/vermaseren/form/issues/186. Should they be treated in more general way, or should each case for each buildin function be implemented?

— 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/196, or mute the thread https://github.com/notifications/unsubscribe-auth/AFLxEkFiB17ocLD_FXhg-5qFp855rGFZks5sCG6TgaJpZM4N0rGq.

tueda commented 7 years ago

As far as I unserstand, 59fe3680b6 should pass the following test?

*--#[ Issue196 :
* $args in gcd_ and more?
S x,y;
CF f;

#procedure AssignField(dollar,?a)
  #$tmp = f(`?a');
  #inside $tmp
    if (match(f(?a`dollar')) == 0) exit;
  #endinside
#endprocedure

#call AssignField($a0,0,0)
#call AssignField($a1,10)
#call AssignField($a2,0,x)
#call AssignField($a3,0,x,y)
#call AssignField($aa,x^2+4*x-3,x+3)
L F0 = gcd_($a0);
L F1 = gcd_($a1);
L F2 = gcd_($a2);
L F3 = gcd_($a3);
L F4 = gcd_($aa);
L F5 = mul_($aa);
L F6 = div_($aa);
L F7 = rem_($aa);
L F8 = inverse_($aa);
P;
.end
assert succeeded?
assert result("F0") =~ expr("0")
assert result("F1") =~ expr("10")
assert result("F2") =~ expr("x")
assert result("F3") =~ expr("1")
assert result("F4") =~ expr("1")
assert result("F5") =~ expr("- 9 + 9*x + 7*x^2 + x^3")
assert result("F6") =~ expr("1 + x")
assert result("F7") =~ expr("- 6")
assert result("F8") =~ expr("- 1/6")
*--#] Issue196 : 

But unfortunately not:

FORM 4.1 (Jun  9 2017, v4.1-20131025-354-g59fe368) 64-bits  Run: Fri Jun  9 18:08:55 2017

Program terminating at 196.frm Line 27 --> 
Segmentation fault (core dumped)

gcd_ became worse in the sense that it now gives a wrong result F4 = 0 without any errors.