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

Missing Expr[x] with B+ for functions #162

Closed tueda closed 7 years ago

tueda commented 7 years ago

B+ doesn't work well for functions and Expr[...] often gives 0.

#-
#define N "5"
#define M "2"
#define P "3"

S x;
CF x1,...,x`M';
S x{`M'+1},...,x`N';

* Test input.

L F = (x1+...+x`N')^`P';
.sort:input;

* Bracket for some functions.

B+ x1,...,x`M';
Print[];
.sort:bracket;
Hide;

* Check if all entries exist.

L FF = F;
B x1,...,x`M';
.sort:test input;
Keep Brackets;

#define failed "0"

$x = term_;
$y = F[$x];
$n = termsin_($y);
if ($n == 0);
  P "Error: F[%$] == %$", $x, $y;
  redefine failed "1";
endif;
.sort:test;

#if `failed'
  #terminate
#endif
.end

gives

FORM 4.1 (Dec 21 2016, v4.1-20131025-285-g25bfe3c) 64-bits  Run: Thu Dec 22 17:45:01 2016
    #-

Time =       0.00 sec    Generated terms =         35
               F         Terms in output =         35
                   input Bytes used      =       1232

Time =       0.00 sec    Generated terms =         35
               F         Terms in output =         35
                 bracket Bytes used      =       1352

   F =
       + x1^3 * (  1 term )

       + x1^2*x2 * (  1 term )

       + x1^2 * (  3 terms )

       + x1*x2^2 * (  1 term )

       + x1*x2 * (  3 terms )

       + x1 * (  6 terms )

       + x2^3 * (  1 term )

       + x2^2 * (  3 terms )

       + x2 * (  6 terms )

       + 1 * (  10 terms );

Time =       0.00 sec    Generated terms =         35
              FF         Terms in output =         35
              test input Bytes used      =       1352
Error: F[x1^3] == 0
Error: F[x1^2*x2] == 0
Error: F[x1^2] == 0
Error: F[x1*x2^2] == 0
Error: F[x1*x2] == 0
Error: F[x2^3] == 0
Error: F[x2] == 0

Time =       0.00 sec    Generated terms =         35
              FF         Terms in output =         35
                    test Bytes used      =       1232
Program terminating at test.frm Line 37 --> 

Using B- seems to be safe but can be considerably slow.

tueda commented 7 years ago

Unfortunately, this issue has not been fixed yet.

vermaseren commented 7 years ago

Hi Takahiro,

I am now working on 162 and that one is rather interesting/nasty. When followed by HAAKJE and more stuff x1x1x1 comes before x1 but without in the routine that searches for the brackets in the index it comes after. I have to think how to solve that one without changing things for the user (like putting x1( before x1x1x1( ).

Cheers

Jos

On 13 jan. 2017, at 21:32, Takahiro Ueda notifications@github.com wrote:

Unfortunately, this issue has not been fixed yet.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vermaseren/form/issues/162#issuecomment-272540606, or mute the thread https://github.com/notifications/unsubscribe-auth/AFLxEr9to6eRdTe_ih4-V_18Y1yBjm6aks5rR99SgaJpZM4LUKog.

vermaseren commented 7 years ago

Hi Takahiro,

The following little program shows the problem very clearly:

CF  f1;
Off Statistics;
L   F = f1^3+f1^2+f1+1;
Print +f;
.sort

F = 1 + f1 + f1^2 + f1^3;

B   f1;
Print +f;
.end

F =

I guess I better change the order in the bracket case. There is the danger that it breaks peoples programs. Alternatively I have to add the HAAKJE object to all brackets in the index and work from there. Maybe that is the better solution.

Cheers

Jos

On 13 jan. 2017, at 21:32, Takahiro Ueda notifications@github.com wrote:

Unfortunately, this issue has not been fixed yet.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vermaseren/form/issues/162#issuecomment-272540606, or mute the thread https://github.com/notifications/unsubscribe-auth/AFLxEr9to6eRdTe_ih4-V_18Y1yBjm6aks5rR99SgaJpZM4LUKog.