Bug introduced in 9.0 and fixed in 11.3.0
Consider the following symbolic expression (all the c
's are undefined)
exp = (-4*I)*(-1 + c22)*Pi*c1[c7[c12], c7[Glu5], c7[c9[c1312][0]]]*
c13[{c7[Glu5], c7[c9[c1312][0]]}, c10[c25], c10[c24]]*
c8[c11[c15, c6], c5[l, c6]]*
c4[c5[p2, c6], c6].c4[c5[l, c6], c6].c4[c5[p1, c6], c6]*c40[c15]*
c40[c20] - (4*I)*(-1 + c22)*Pi*
c1[c7[c12], c7[Glu5], c7[c9[c1312][0]]]*
c13[{c7[Glu5], c7[c9[c1312][0]]}, c10[c25], c10[c24]]*
c8[c11[c15, c6], c5[p2, c6]]*
c4[c5[p1, c6], c6].c4[c5[p2, c6], c6]*c40[c14]*c40[c15]*
c40[c20] - (4*I)*(-1 + c22)*Pi*
c1[c7[c12], c7[Glu5], c7[c9[c1312][0]]]*
c13[{c7[Glu5], c7[c9[c1312][0]]}, c10[c25],
c10[c24]]*(c8[c5[p1, c6], c5[p1, c6]] -
2*c8[c5[p1, c6], c5[p2, c6]] +
c8[c5[p2, c6],
c5[p2, c6]])*(c4[c5[p1, c6], c6].c4[c5[p1, c6], c6].c4[
c11[c15, c6], c6] -
c4[c5[p2, c6], c6].c4[c5[p1, c6], c6].c4[c11[c15, c6], c6] +
c4[c5[p1, c6], c6].c4[c11[c15, c6], c6]*c40[c14] -
c4[c5[p2, c6], c6].c4[c11[c15, c6], c6]*c40[c14])*c40[c15]*
c40[c20] + (4*I)*(-1 + c22)*Pi*
c1[c7[c12], c7[Glu5], c7[c9[c1312][0]]]*
c13[{c7[Glu5], c7[c9[c1312][0]]}, c10[c25], c10[c24]]*
c8[c11[c15, c6],
c5[p1, c6]]*(c4[c5[p1, c6], c6].c4[c5[p1, c6], c6].c4[c5[p1, c6],
c6] - c4[c5[p1, c6], c6].c4[c5[p1, c6], c6].c4[c5[p2, c6],
c6] - c4[c5[p2, c6], c6].c4[c5[p1, c6], c6].c4[c5[p1, c6],
c6] + c4[c5[p2, c6], c6].c4[c5[p1, c6], c6].c4[c5[p2, c6],
c6] + c4[c5[p1, c6], c6].c4[c5[p1, c6], c6]*c40[c14] -
c4[c5[p1, c6], c6].c4[c5[p2, c6], c6]*c40[c14] -
c4[c5[p2, c6], c6].c4[c5[p1, c6], c6]*c40[c14] +
c4[c5[p2, c6], c6].c4[c5[p2, c6], c6]*c40[c14])*c40[c15]*
c40[c20];
Now try to evaluate the following code
AbsoluteTiming[res1 = Simplify[exp];]
AbsoluteTiming[res2 = Factor[exp];]
Simplify[res1 - res2]
On Mathematica 8 (Linux version) both Simplify
and Factor
finish in less than 0.1 seconds. However, with all newer versions (9, 10.3, 11.0) that I have, Factor
never finishes, while Simplify
is still very fast.
To me this looks like a bug/regression, but may be someone has a sensible explanation for this behavior. I have not reported this to WRI so far, but I'm planning to do so.
Edit:
res1
is
(-4*I)*(-1 + c22)*Pi*c1[c7[c12], c7[Glu5], c7[c9[c1312][0]]]*
c13[{c7[Glu5], c7[c9[c1312][0]]}, c10[c25], c10[c24]]*c40[c15]*c40[c20]*
(c40[c14]*c8[c11[c15, c6], c5[p2, c6]]*c4[c5[p1, c6], c6] .
c4[c5[p2, c6], c6] + c8[c11[c15, c6], c5[l, c6]]*
c4[c5[p2, c6], c6] . c4[c5[l, c6], c6] . c4[c5[p1, c6], c6] +
(c8[c5[p1, c6], c5[p1, c6]] - 2*c8[c5[p1, c6], c5[p2, c6]] +
c8[c5[p2, c6], c5[p2, c6]])*
(c40[c14]*(c4[c5[p1, c6], c6] . c4[c11[c15, c6], c6] -
c4[c5[p2, c6], c6] . c4[c11[c15, c6], c6]) +
c4[c5[p1, c6], c6] . c4[c5[p1, c6], c6] . c4[c11[c15, c6], c6] -
c4[c5[p2, c6], c6] . c4[c5[p1, c6], c6] . c4[c11[c15, c6], c6]) -
c8[c11[c15, c6], c5[p1, c6]]*
(c40[c14]*(c4[c5[p1, c6], c6] . c4[c5[p1, c6], c6] -
c4[c5[p1, c6], c6] . c4[c5[p2, c6], c6] - c4[c5[p2, c6], c6] .
c4[c5[p1, c6], c6] + c4[c5[p2, c6], c6] . c4[c5[p2, c6], c6]) +
c4[c5[p1, c6], c6] . c4[c5[p1, c6], c6] . c4[c5[p1, c6], c6] -
c4[c5[p1, c6], c6] . c4[c5[p1, c6], c6] . c4[c5[p2, c6], c6] -
c4[c5[p2, c6], c6] . c4[c5[p1, c6], c6] . c4[c5[p1, c6], c6] +
c4[c5[p2, c6], c6] . c4[c5[p1, c6], c6] . c4[c5[p2, c6], c6]))
res2
is
(-4*I)*(-1 + c22)*Pi*c1[c7[c12], c7[Glu5], c7[c9[c1312][0]]]*
c13[{c7[Glu5], c7[c9[c1312][0]]}, c10[c25], c10[c24]]*c40[c15]*c40[c20]*
(c40[c14]*c8[c5[p1, c6], c5[p1, c6]]*c4[c5[p1, c6], c6] .
c4[c11[c15, c6], c6] - 2*c40[c14]*c8[c5[p1, c6], c5[p2, c6]]*
c4[c5[p1, c6], c6] . c4[c11[c15, c6], c6] +
c40[c14]*c8[c5[p2, c6], c5[p2, c6]]*c4[c5[p1, c6], c6] .
c4[c11[c15, c6], c6] - c40[c14]*c8[c11[c15, c6], c5[p1, c6]]*
c4[c5[p1, c6], c6] . c4[c5[p1, c6], c6] +
c40[c14]*c8[c11[c15, c6], c5[p1, c6]]*c4[c5[p1, c6], c6] .
c4[c5[p2, c6], c6] + c40[c14]*c8[c11[c15, c6], c5[p2, c6]]*
c4[c5[p1, c6], c6] . c4[c5[p2, c6], c6] -
c40[c14]*c8[c5[p1, c6], c5[p1, c6]]*c4[c5[p2, c6], c6] .
c4[c11[c15, c6], c6] + 2*c40[c14]*c8[c5[p1, c6], c5[p2, c6]]*
c4[c5[p2, c6], c6] . c4[c11[c15, c6], c6] -
c40[c14]*c8[c5[p2, c6], c5[p2, c6]]*c4[c5[p2, c6], c6] .
c4[c11[c15, c6], c6] + c40[c14]*c8[c11[c15, c6], c5[p1, c6]]*
c4[c5[p2, c6], c6] . c4[c5[p1, c6], c6] -
c40[c14]*c8[c11[c15, c6], c5[p1, c6]]*c4[c5[p2, c6], c6] .
c4[c5[p2, c6], c6] + c8[c5[p1, c6], c5[p1, c6]]*
c4[c5[p1, c6], c6] . c4[c5[p1, c6], c6] . c4[c11[c15, c6], c6] -
2*c8[c5[p1, c6], c5[p2, c6]]*c4[c5[p1, c6], c6] . c4[c5[p1, c6], c6] .
c4[c11[c15, c6], c6] + c8[c5[p2, c6], c5[p2, c6]]*
c4[c5[p1, c6], c6] . c4[c5[p1, c6], c6] . c4[c11[c15, c6], c6] -
c8[c11[c15, c6], c5[p1, c6]]*c4[c5[p1, c6], c6] . c4[c5[p1, c6], c6] .
c4[c5[p1, c6], c6] + c8[c11[c15, c6], c5[p1, c6]]*
c4[c5[p1, c6], c6] . c4[c5[p1, c6], c6] . c4[c5[p2, c6], c6] +
c8[c11[c15, c6], c5[l, c6]]*c4[c5[p2, c6], c6] . c4[c5[l, c6], c6] .
c4[c5[p1, c6], c6] - c8[c5[p1, c6], c5[p1, c6]]*
c4[c5[p2, c6], c6] . c4[c5[p1, c6], c6] . c4[c11[c15, c6], c6] +
2*c8[c5[p1, c6], c5[p2, c6]]*c4[c5[p2, c6], c6] . c4[c5[p1, c6], c6] .
c4[c11[c15, c6], c6] - c8[c5[p2, c6], c5[p2, c6]]*
c4[c5[p2, c6], c6] . c4[c5[p1, c6], c6] . c4[c11[c15, c6], c6] +
c8[c11[c15, c6], c5[p1, c6]]*c4[c5[p2, c6], c6] . c4[c5[p1, c6], c6] .
c4[c5[p1, c6], c6] - c8[c11[c15, c6], c5[p1, c6]]*
c4[c5[p2, c6], c6] . c4[c5[p1, c6], c6] . c4[c5[p2, c6], c6])
Answer
This bug in Factor
has been addressed as of version 11.3.0.
While the example may take some seconds to run, it will not hang
AbsoluteTiming[res1 = Simplify[exp];]
AbsoluteTiming[res2 = Factor[exp];]
Simplify[res1 - res2]
(* {0.060817, Null} *)
(* {13.5211, Null} *)
(* 0 *)
Comments
Post a Comment