vermaseren / form

The FORM project for symbolic manipulation of very big expressions
GNU General Public License v3.0
982 stars 118 forks source link

"Internal error in code generator. Unknown object: -25" with d_ squared #341

Open magv opened 4 years ago

magv commented 4 years ago

Hi, folks. I get an "Internal error in code generator" when d_() squared appears; here's a short snippet:

I idx1, idx2;
L EXPR = d_(idx1, idx2)^2;
.sort
.end

Here's the result of running it:

$ form x.frm 
FORM 4.2.1 (Aug 28 2019, v4.2.1-5-g4057c65) 64-bits  Run: Thu Jan  9 14:16:11 2020
    I idx1, idx2;
    L EXPR = d_(idx1, idx2)^2;
x.frm Line 2 --> Internal error in code generator. Unknown object: -25
    .sort
    .end
Program terminating at x.frm Line 2 --> 
  0.00 sec out of 0.00 sec

Changing d_(idx1, idx2)^2 into d_(idx1, idx2)*d_(idx1, idx2) produces the correct 4 as the result.

For the moment one can work around this by using e.g. delta in stead of d_ in the input and then running an additional id, but would it be possible to fix the internal error instead?

vermaseren commented 4 years ago

This is not completely trivial to fix, because d in a rather special object. It would need quite special code. The easiest work around is to use (d(idx1,idx2))^2.

On 9 Jan 2020, at 14:22, Vitaly Magerya notifications@github.com wrote:

I idx1, idx2; L EXPR = d_(idx1, idx2)^2; .sort .end

magv commented 4 years ago

On 09/01/2020 15:01, Jos Vermaseren wrote:

The easiest work around is to use (d_(idx1,idx2))^2.

That's a much better workaround. Thanks.