7
$\begingroup$

I stumbled across this amusing issue today when doing some definite integrals:

integrand[x_] := Sqrt[1 + a (-1 + x)]
Integrate[integrand[x], {x, -1, 1}, Assumptions -> True]
Integrate[integrand[x], {x, -1, 1}, Assumptions -> sky == "blue"]

which then gives the results

(2 (1 - (1 - 2 a)^(3/2)))/(3 a)

and

ConditionalExpression[(2 - 2 Sqrt[1 - 2 a] + 4 Sqrt[1 - 2 a] a)/( 3 a), 
Re[1/a] == 1 || Re[1/a] >= 2 || Re[1/a] <= 0 || 1/a \[NotElement] Reals) 
&& Re[a] < 1]

As you can see, the results appear quite different, even though the input varied only by adding an utterly irrelevant assumption. The latter result is the same as the former, within its limited domain of applicability. But is the former result generally correct?

I'm using Mathematica 9.0.1, if that makes any difference. The above was performed on a freshly restarted kernel.

$\endgroup$
  • $\begingroup$ looks like perhaps changing the assumptions is impacting the default generateconditions behavior. see what you get if you explicitly set that. $\endgroup$ – george2079 Dec 10 '14 at 13:53
  • $\begingroup$ Are you asking "why this happens?" or "is the former result generally correct?" ? $\endgroup$ – Dr. belisarius Dec 10 '14 at 15:06
  • 1
    $\begingroup$ What happens when pigs fly? :) $\endgroup$ – Michael E2 Dec 10 '14 at 16:20
  • $\begingroup$ @MichaelE2 Then they start playing good music $\endgroup$ – Dr. belisarius Dec 10 '14 at 17:58
5
$\begingroup$

confirming my comment..

   Integrate[ Sqrt[ 1 + a (x - 1) ] , {x, -1, 1}],
   Integrate[ Sqrt[ 1 + a (x - 1) ] , {x, -1, 1}, Assumptions -> True]
   Integrate[ Sqrt[ 1 + a (x - 1) ] , {x, -1, 1}, GenerateConditions -> True]
   Integrate[ Sqrt[ 1 + a (x - 1) ] , {x, -1, 1}, Assumptions -> {y == 3}]
   Integrate[ Sqrt[ 1 + a (x - 1) ] , {x, -1, 1}, Assumptions -> {Re[1/a] != 1}]
   Integrate[ Sqrt[ 1 + a (x - 1) ] , {x, -1, 1}, Assumptions -> {Element[a, Reals]}]

enter image description here

Pretty much any non-default Assumption sets GenerateConditions->True. (why it defaults to False in this case is a fair question)

Looking at another example:

Integrate[ 1/(1 - a x) , {x, -1, 1}]
Integrate[ 1/(1 - a x) , {x, -1, 1}, Assumptions -> True]
Integrate[ 1/(1 - a x) , {x, -1, 1}, GenerateConditions -> True]
Integrate[ 1/(1 - a x) , {x, -1, 1}, Assumptions -> {y == 3}]
Integrate[ 1/(1 - a x) , {x, -1, 1}, Assumptions -> {Element[a, Reals]}]

enter image description here

We see again the superfluous assumption has evidently set GenerateConditions->True. Oddly the default here gives a different conditional expression.

$\endgroup$
  • $\begingroup$ +1 I've seen GenerateConditions default to False when there is only one conditional before $\endgroup$ – Dr. belisarius Dec 10 '14 at 15:52
  • $\begingroup$ Thanks for the answer. I never realised that GenerateConditions defaulted to False - that seems quite dangerous. I suppose it could be because generating conditions is quite slow. $\endgroup$ – Widjet Dec 11 '14 at 0:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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