vermaseren / form

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

[tform] Wrong result from ToPolynomial and rational arithmetics with non-symbols #138

Open tueda opened 8 years ago

tueda commented 8 years ago

ToPolynomial and FactArg can't be used in the same module because of the mutual exclusion of ConvertToPoly and LocalConvertToPoly. (I think this restriction is not needed with the sequential FORM). This mutual exclusion in other cases seems not implemented. The following example is expected to give F=0:

On allwarnings;
CF f,a,b,c,d;
S x,y;
L F = (1+f((a+b)^2,(a+b)*(c*d)))^20;
.sort
id f(x?,y?) = f(gcd_(x,y));  * f((a+b)^2,(a+b)*(c*d)) -> f(a+b)
topolynomial;
.sort
frompolynomial;
id f(a+b) = -1;
P +s;
.end

but TFORM gives random results. In ParFORM, simply the parallelization in modules with topolynomial is switched off and it gives the correct result.

tueda commented 8 years ago

As far as I can see:

tueda commented 8 years ago

Solutions would be:

  1. Check the problematic statements and tokens, and set TOPOLYNOMIALFLAG (ToPolynomial) or FACTARGFLAG (FactArg, FactDollar, div_ and gcd_) to AC.topolynomialflag. If the both are set in a module, turn off the parallelization.
  2. Check only ToPolynomial. If LocalConvertToPoly is called in a module with ToPolynomial on TFORM and if non-symbols are involved, then give a runtime error.

Anyway, giving a compilation error is overkill. Am I right?

vermaseren commented 8 years ago

Hi Takahiro,

I just got home. I will have to think a bit about this one. Alternative would be to call it with a lock. And give a warning about this.

You could do that just for trying out the rest of the new code and then we can still decide later what to really do about the parallelization.

Cheers

Jos

On 4 nov. 2016, at 18:46, Takahiro Ueda notifications@github.com wrote:

Solutions may be:

Check the problematic statements and tokens, and set TOPOLYNOMIALFLAG (ToPolynomial) or FACTARGFLAG (FactArg, FactDollar, div and gcd) to AC.topolynomialflag. If the both are set in a module, turn off the parallelization. Check only ToPolynomial. If LocalConvertToPoly is called in a module with ToPolynomial, then give a runtime error. Anyway, giving a compilation error is overkill. Am I right?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vermaseren/form/issues/138#issuecomment-258500778, or mute the thread https://github.com/notifications/unsubscribe-auth/AFLxEsoP-bms6f2pCA_8SXK77GwdAeZ_ks5q629ngaJpZM4KpwhA.

jodavies commented 5 months ago

The random results with no error is not very nice here; I think for FORM5 this one needs fixing or terminate with an error message?