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

Polyratfun coming from function argument does not add properly #190

Closed benruijl closed 7 years ago

benruijl commented 7 years ago

The following program shows that moving a polyratfun out of a function may produce a wrong result.

I suspect there is a problem with the ordering of the monomials in the polyratfun which changes when it leaves the function and goes to ground level, which causes the add routine to produce a wrong result.

Auto S x1,x2,ep;
CF f,rat;
Polyratfun rat;

* x1 and x2 should have coefficient -1
L F = 
      +f((rat(1-ep,1)*x1-2*x2)*rat(1,1+ep))
      +f((rat(1-ep,1)*x2-2*x1)*rat(1,1+ep))
;

id f(x1?) = x1;

Print +s;
.end
jodavies commented 7 years ago

I get

   F =
       + x2*rat(-1,1)
       + x1*rat(-1,1)
      ;

with 320a477 , 5634f18 , 6b38064 .

cf71752 is bad, though, giving

   F =
       + x2*rat( - 3*ep - 2,ep)
       + x1*rat( - 3*ep - 2,ep)
      ;
benruijl commented 7 years ago

Thanks Josh! I will git bisect it soon to find the bad commit.

tueda commented 7 years ago

As you can imagine, this bug was introduced by a0b635c.

BAD  * c8cdc42 [2017-04-19] [test] Test case for #128 @Takahiro Ueda 
BAD  * 7976927 [2017-04-19] The permute in transform did not handle local dollars properly in tform. @vermaseren 
BAD  * 41642ab [2017-04-16] Added the use of $-variables to the permute option in the transform statement. @vermaseren 
BAD  * 929268a [2017-04-14] [test] An example of perm_, given in 31d4b6b @Takahiro Ueda 
BAD  * 4e28f92 [2017-04-14] Repaired a little mistake in the manual. @vermaseren 
BAD  * 31d4b6b [2017-04-14] Added function perm_ to the manual @vermaseren 
BAD  * 7ded5c9 [2017-04-14] Added the permutations function perm_ @vermaseren 
BAD  * a995a3c [2017-04-09] Man sorting into a chapter @vermaseren 
BAD  * 81d838a [2017-04-08] [build][doc] Include spectators.tex @Takahiro Ueda 
BAD  * af374eb [2017-04-08] Forgot to add spectators.tex @vermaseren 
BAD  * ff98159 [2017-04-07] Added spectators to the manual @vermaseren 
BAD  * 1470f0b [2017-04-06] Added trailing - option to polyratfun. Dangerous! @vermaseren 
BAD  * 72fc216 [2017-04-05] [test] Put a test case from #178 @Takahiro Ueda 
BAD  * e24fd09 [2017-04-05] Repaired fix.frm @vermaseren 
BAD  * f74b7b5 [2017-04-05] Repaired a crash reported by Josh Davies @vermaseren 
BAD  * 5b55fdb [2017-04-04] Changed CLEANPRF into MUSTCLEANPRF @vermaseren 
BAD  *   6c957e4 [2017-04-04] optimized poly_ratfun_normalize Merge branch 'master' of github.com:vermaseren/form @vermaseren 
     |\  
BAD  | * a675751 [2017-04-03] [test] Test case for #180 @Takahiro Ueda 
BAD  * | c41e6af [2017-04-04] Optimized poly_ratfun_normalize: only dirty functions are normalized. @vermaseren 
     |/  
BAD  * 2fb697d [2017-04-03] Fixed up RAT and a few imperfections of poly_ratfun_normalize @vermaseren 
BAD  * 74cfccd [2017-04-03] Fix an invalid memory access for ParFORM @Takahiro Ueda 
BAD  * a7392f5 [2017-04-03] Reapply the patch of dd92c10 @Takahiro Ueda 
BAD  * cda04e9 [2017-04-03] [build] Bug reports should be sent to the Issue Tracker @Takahiro Ueda 
BAD  * 5fc9a7e [2017-04-03] fixed up the previous fixes and some asserts in the ruby file @vermaseren 
BAD  * 86a5228 [2017-04-02] Fixed up the expand part of PolyRatFun that went wrong with the polywrap.cc fix @vermaseren 
BAD  *   edd914d [2017-04-02] Repaired inefficiency in PolyRatFun. Added debug code. Etc. Merge branch 'master' of github.com:vermaseren/form @vermaseren 
     |\  
GOOD | * 5634f18 [2017-03-31] Fix for activeexprnames_ with replaced expressions @Takahiro Ueda 
BAD  * | a0b635c [2017-04-02] Repaired major inefficiency with PolyRatFun. Added lots of debug code. Replaced many Malloc1 calls. Reinstated MaxNumberSize setup option. @vermaseren 
     |/  
GOOD * a4fd5e1 [2017-03-29] Add support for absolute paths in #Append/PrependPath @Takahiro Ueda 
GOOD * 29c1794 [2017-03-27] Implement #Append/PrependPath @Takahiro Ueda 
GOOD * 1d7338d [2017-03-17] [doc] Put Ben in the author list of the manual @Takahiro Ueda 
GOOD *   7c56626 [2017-03-17] Merge branch 'exprvars' @Takahiro Ueda