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

Wrong result of content_ #185

Closed tueda closed 6 years ago

tueda commented 7 years ago

As far as I understand, content_ gives an overall factor of an expression such that if the original expression is divided by it then all terms in the quotient have integer coefficients and are without negative powers of symbols. For example,

* This is OK.
S x,y;
#$p = (x/3+2/y)^2;
#$c = content_($p);
#$q = $p/$c;
#message (`$p')/(`$c') = `$q'
.end

gives

~~~(4*y^-2+4/3*x*y^-1+1/9*x^2)/(1/9*y^-2) = 36+12*x*y+x^2*y^2

But it doesn't work when the input has a constant term, like

* This is BAD.
S x;
#$p = 1+1/x;
#$c = content_($p);
#$q = $p/$c;
#message (`$p')/(`$c') = `$q'
.end
~~~(1+x^-1)/(1) = 1+x^-1

In this case the content should be 1/x.

tueda commented 7 years ago

A workaround:

FORM 4.1 (Jun 14 2017, v4.1-20131025-356-g541f847) 64-bits  Run: Thu Jun 22 12:41:42 2017
    S x,xxx;
    #$p = 1+1/x;
    #$tmp = $p*xxx;
    #$c = content_($tmp)/xxx;
    #$q = $p/$c;
    #message (`$p')/(`$c') = `$q'
~~~(1+x^-1)/(x^-1) = 1+x
    .end
tueda commented 6 years ago

Fixed by 68d5cb1fc297b1983b1c228a95b1331073535341.