Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Puzzling behavior of factarg (freezes etc.) #353

Closed
vsht opened this issue Jun 23, 2020 · 8 comments
Closed

Puzzling behavior of factarg (freezes etc.) #353

vsht opened this issue Jun 23, 2020 · 8 comments
Labels
bug Something isn't working

Comments

@vsht
Copy link

vsht commented Jun 23, 2020

Perhaps it is my lack of understanding of factarg, but I'm wondering
why the following simple code

CF f;
S p1,p2;

L exp = f(-p1-p2);

factarg,(0),f;
print;
.end

makes FORM freeze? Modifying the argument slightly

CF f;
S p1,p2;

L exp = f(p1+p2);

factarg,(0),f;

print;

.end

outputs

   exp =
      162000*f*pi_*p1;

which is even more weird. An if p1 and p2 are promoted to vectors, then with

CF f;
V p1,p2;

L exp = f(p1+2*p2);

factarg,(0),f;

print;

.end

I get

!!!This $ variation has not been implemented yet!!!
Called from execarg
Program terminating at /home/vs/Downloads/FORM-test-script.frm 
Line 8 --> 

All these examples work properly if I employ normalize,(0),f; instead of factarg,(0),f; which is also sufficient
for what I'm interested in. Still, since the documentation (p.86) says

`(0) Eliminates the coefficient of the term in the argument. Similar to Normalize,(0),....

I though that both statements should produce similar results.

Cheers
Vladyslav

@jodavies
Copy link
Collaborator

jodavies commented Jun 23, 2020

For me your example simply hangs, with nothing useful from valgrind.

Edit: the Vector example, however, does produce some useful valgrind output which is perhaps a clue.

==27642== Conditional jump or move depends on uninitialised value(s)
==27642==    at 0x45DF66: Normalize (normal.c:534)
==27642==    by 0x40B8F7: execarg (argument.c:1704)
==27642==    by 0x4BEDB8: Generator (proces.c:3445)
==27642==    by 0x4BFAA0: Generator (proces.c:3824)
==27642==    by 0x4BFF0A: Generator (proces.c:3992)
==27642==    by 0x4C148A: Processor (proces.c:405)
==27642==    by 0x43B2B4: DoExecute (execute.c:843)
==27642==    by 0x454A84: ExecModule (module.c:274)
==27642==    by 0x4B71F3: PreProcessor (pre.c:967)
==27642==    by 0x4F1C99: main (startup.c:1619)
==27642==
==27642== Conditional jump or move depends on uninitialised value(s)
==27642==    at 0x45DF6B: Normalize (normal.c:542)
==27642==    by 0x40B8F7: execarg (argument.c:1704)
==27642==    by 0x4BEDB8: Generator (proces.c:3445)
==27642==    by 0x4BFAA0: Generator (proces.c:3824)
==27642==    by 0x4BFF0A: Generator (proces.c:3992)
==27642==    by 0x4C148A: Processor (proces.c:405)
==27642==    by 0x43B2B4: DoExecute (execute.c:843)
==27642==    by 0x454A84: ExecModule (module.c:274)
==27642==    by 0x4B71F3: PreProcessor (pre.c:967)
==27642==    by 0x4F1C99: main (startup.c:1619)
==27642==
==27642== Conditional jump or move depends on uninitialised value(s)
==27642==    at 0x45DF70: Normalize (normal.c:578)
==27642==    by 0x40B8F7: execarg (argument.c:1704)
==27642==    by 0x4BEDB8: Generator (proces.c:3445)
==27642==    by 0x4BFAA0: Generator (proces.c:3824)
==27642==    by 0x4BFF0A: Generator (proces.c:3992)
==27642==    by 0x4C148A: Processor (proces.c:405)
==27642==    by 0x43B2B4: DoExecute (execute.c:843)
==27642==    by 0x454A84: ExecModule (module.c:274)
==27642==    by 0x4B71F3: PreProcessor (pre.c:967)
==27642==    by 0x4F1C99: main (startup.c:1619)
==27642==
==27642== Conditional jump or move depends on uninitialised value(s)
==27642==    at 0x45DF79: Normalize (normal.c:587)
==27642==    by 0x40B8F7: execarg (argument.c:1704)
==27642==    by 0x4BEDB8: Generator (proces.c:3445)
==27642==    by 0x4BFAA0: Generator (proces.c:3824)
==27642==    by 0x4BFF0A: Generator (proces.c:3992)
==27642==    by 0x4C148A: Processor (proces.c:405)
==27642==    by 0x43B2B4: DoExecute (execute.c:843)
==27642==    by 0x454A84: ExecModule (module.c:274)
==27642==    by 0x4B71F3: PreProcessor (pre.c:967)
==27642==    by 0x4F1C99: main (startup.c:1619)
==27642==
!!!This $ variation has not been implemented yet!!!
Called from execarg

@tueda
Copy link
Collaborator

tueda commented Jun 23, 2020

Your second example (weird pi_) sounds like #140.

@tueda
Copy link
Collaborator

tueda commented Jun 23, 2020

Actually, the oldest version form 4.0.0 (FORM 4.0 (Mar 29 2012)) that I can test gives the same results for your 3 examples (freeze, 162000*f*pi_*p1 and !!!This $ variation has not been implemented yet!!!).

@tueda tueda added the bug Something isn't working label Jun 23, 2020
vermaseren added a commit that referenced this issue Jul 15, 2020
@vermaseren
Copy link
Owner

It seems that the(0) option had never been tested on the case that no factor needed to be divided out. The latest commit should take care of it.

@vsht
Copy link
Author

vsht commented Jul 16, 2020

Great, many thanks!

@vsht vsht closed this as completed Jul 16, 2020
@tueda
Copy link
Collaborator

tueda commented Jul 17, 2020

I'm confused; to me, any of the above examples still doesn't work and behaves erroneously, though something seemed to be done in 9b0b89b... For example:

$ ./vorm test.frm
FORM 4.2.1 (Jul 15 2020, v4.2.1-9-g9b0b89b) 64-bits  Run: Fri Jul 17 18:20:17 2020
    CF f;
    S p1,p2;

    L exp = f(p1+p2);

    factarg,(0),f;

    print;

    .end

Time =       0.00 sec    Generated terms =          1
             exp         Terms in output =          1
                         Bytes used      =         56

   exp =
      162000*f*pi_*p1;

  0.00 sec out of 0.00 sec

@vsht
Copy link
Author

vsht commented Jul 17, 2020

Sorry, I didn't have time to check it yesterday and I assumed that if this specific issue
was mentioned then the examples will for sure work.

I agree with Takahiro, it seems that all of the original code samples still do not work
as they should.

@vsht vsht reopened this Jul 17, 2020
vermaseren added a commit that referenced this issue Jul 17, 2020
Merge branch 'master' of github.com:vermaseren/form
tueda added a commit that referenced this issue Jul 18, 2020
@tueda
Copy link
Collaborator

tueda commented Jul 18, 2020

Now it seems to work.

@tueda tueda closed this as completed Jul 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants