28
$\begingroup$

I've updated today to Mathematica 9.0.1.0 from version 8 and found something that absolutely confuses me.
Let us define a piecewise function:

gr[x_, v1_, v2_, v3_, v4_, v5_] = 
Piecewise[{{g, v1 < x < v1+v2}, {g, v1+v3 < x < v1+v2+v3}, 
{gs, v1+v2+v3+v4 < x < v1+v3+v2+v4+v5}}, 0]

and try integrating it with obvious assumptions:

Integrate[gr[x, a, b, c, d, e], {x, 0, END}, 
Assumptions -> {0 < a < a+b < a+c < a+b+c < a+b+c+d < a+b+c+d+e < END}]

This takes around 60 seconds and obviously results in 2 b g + e gs (although it seems it was a lot faster in Mathematica 8, though it's not the point here). Now, if we do the very same integration, but with different symbols:

Integrate[gr[x, τ, δ, Δ, τs, δs], {x, 0, TR}, 
Assumptions -> {0 < τ < τ+δ < τ+Δ < τ+δ+Δ < τ+δ+Δ+τs < τ+δ+Δ+τs+δs < TR}]

All of a sudden this doesn't evaluate in 60 seconds, running till it pages all the memory available and crashing afterwads. Can anyone explain this?

$\endgroup$
7
  • 1
    $\begingroup$ Interesting. Make a simpler version, use a symbol for the lower integration limit also, add them and the variables involved in the assumptions as Reals: MMA generates same result, but with wildy convoluted conditions when using greeks vs non, along with taking longer. $\endgroup$
    – ciao
    Commented Feb 28, 2014 at 8:57
  • 1
    $\begingroup$ Maybe a similar issue of this? BTW, confirmed in v8.0.4 too. $\endgroup$
    – xzczd
    Commented Feb 28, 2014 at 9:08
  • 1
    $\begingroup$ Looks like a similar issue. Now, tested it on 8.0.4.0 too, the non-Greek expression evaluates a bit faster, but that's probably due to a faster hardware. Also, actually no need to replace all the variables with Greek letters, just swapping a for τ is sufficient to stop the expression from evaluating. $\endgroup$
    – Mike
    Commented Feb 28, 2014 at 9:34
  • 4
    $\begingroup$ It's not about greek or not greek. It's about the sorting of the symbols. Some of these functions which, theoretically, should be invariant to that, are not. There was another question around, perhaps related to Solve $\endgroup$
    – Rojo
    Commented Feb 28, 2014 at 16:23
  • 9
    $\begingroup$ They (the present example and the Solve one) are similar issues. At heart, as noted by @Rojo, it has to do with internal ordering having an impact on simplification, cylindrical decomposition, and other under-the-hood functionality that is called upon by the likes of Integrate and Solve. We'll look into these examples but I am doubtful as to whether they are readily remediated. $\endgroup$ Commented Feb 28, 2014 at 18:27

1 Answer 1

4
$\begingroup$

I think Daniel Lichtblau gave a useful answer in his comment. This is to get it on record.

They (the present example and the Solve one) are similar issues. At heart, as noted by @Rojo, it has to do with internal ordering having an impact on simplification, cylindrical decomposition, and other under-the-hood functionality that is called upon by the likes of Integrate and Solve. We'll look into these examples but I am doubtful as to whether they are readily remediated

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.