I've been using the OptimizeExpression
function again recently, and cleaning up the results by hand. Its results have been unbelievably sub-optimal in my recent usage, as opposed to the past. So much so that it doesn't even require manipulation of the results to see.
Have any of you run into this recently? Can you test this on older versions?
For context I'm in Mathematica Online, so I'm using version 12.0.0 for Linux x86 (64-bit) (March 31, 2019). I don't use the desktop version.
f[u1@P]+c f[u2@P]/.f@u_->3/2/u(1/2/u-1/Tan[2u])//FullSimplify
{%,%/D[%,P]}/.{u1->(j1 Sqrt@#&),u2->(j2 Sqrt@#&)}//FullSimplify
Experimental`OptimizeExpression[%,OptimizationSymbol->a]
Power[j1, -2]
and is not the same asa18 = Power[j1, 2]
. I have observed similar behavior toOptimizeExpression
not usingPower[a18, -1]
in place ofPower[j1, -2]
in earlier versions. If you think about it, it is not more optimal; at least on the face of it, both require evaluatingPower
. $\endgroup${(3 a38)/(4 j1^2 j2^2 P), -((P a38)/(a19 + a20 - j1 j2 a25 (a35 + j2 (a27 + 2 j1 a25 (Csc[a26]^2 + c Csc[a29]^2)))))}
which is slightly different, but still has the powers of j1 and j2 in the denominator. $\endgroup$