0
$\begingroup$

Consider the assumptions

$Assumptions = 1 > v > 0 && y1 \[Element] Reals && y2 \[Element] Reals &&   k > 0 && 1 > t1 > 0 

and define

y[t_, y1_, y2_, t1_] = 
      Piecewise[{{y1, 0 <= t <= t1}, {y2, t1 < t <= 1}}, 0];

and two different formulations of the same integral,

Assuming[t1 + v < 1, 
  Integrate[
   Assuming[{0 <= t <= 1, t1 + v < 1}, 
    Integrate[(1 + 
        Exp[-2 Integrate[y[s, y1, y2, t1]^2, {s, t - u - v, t - v}]])/
      2, {u, 0, t}]], {t, v, t1 + v}]] // Simplify

and

Assuming[t1 + v < 1, 
   Integrate[
    Assuming[{0 <= t <= 1, t1 + v < 1}, 
     Integrate[(1 + 
         Exp[-2 Integrate[
            y[s, y1, y2, t1]^2, {s, t - u - v, t - v}]])/2, {u, 0, 
       t - v}]], {t, v, t1 + v}]] + 
  Assuming[t1 + v < 1, 
   Integrate[
    Assuming[{0 <= t <= 1, t1 + v < 1}, 
     Integrate[(1 + 
         Exp[-2 Integrate[
            y[s, y1, y2, t1]^2, {s, t - u - v, t - v}]])/2, {u, t - v,
        t}]], {t, v, t1 + v}]] // Simplify

The two formulations differ for the region of integration, that in the second case is splitted in two parts, because the interval in u between 0 and t is splitted in [0,t-v]+[t-v,t],and then the integrals summed. Why Mathematica give me back two different expressions?

$\endgroup$
4
  • $\begingroup$ Why all those separate Assuming functions? Can't you combine them? $\endgroup$ Commented Jan 16, 2013 at 20:11
  • $\begingroup$ The D you use as a variable is a reserved word. $\endgroup$ Commented Jan 16, 2013 at 20:13
  • $\begingroup$ I combine a bit Assuming. I changed the variable from D to u (in my code I use greek symbols, but to be more clear I changed in D the variable symbol without checking). Also I've added some necessary $Assumptions. The main point is still there. $\endgroup$
    – Nicola
    Commented Jan 16, 2013 at 21:07
  • $\begingroup$ You have a k>0 which seems not needed. $\endgroup$ Commented Jan 17, 2013 at 9:48

1 Answer 1

2
$\begingroup$

Maybe not the answer you're looking for. It took a long time to run your code as it is so I changed it a bit. The bottom line is that Mathematica is doing fine and the two expressions you get just look different.

Some definitions :

myAssum = 1 > v > 0 && y1 \[Element] Reals && y2 \[Element] Reals && 1 > t1 > 0
myConditions = {tMv -> t - v};

because until the last integration everything depends on t-v only, so no point carrying two variables.

intY2 = Simplify[Integrate[PiecewiseExpand[y[s, y1, y2, t1]^2], {s, tMv - u, tMv}, 
                 Assumptions -> {0 <= tMv <= t1, 0 <= u <= t}], 
        Assumptions -> {myAssum, 0 <= tMv <= t1, 0 <= u <= t}];

intExp = Integrate[(1 + Exp[-2 intY2])/2, {u, 0, t},  
                   Assumptions -> {0 <= tMv <= t1, 0 <= t <= 2}];

Now we substitute back tMv -> t-v and do the last integration :

result = Integrate[intExp /. myConditions, {t, v, t1 + v}, 
                   Assumptions -> myAssum];

To check the other approach I just repeat the last two steps :

intExp1 = Integrate[(1 + Exp[-2 intY2])/2, {u, 0, tMv},  
                    Assumptions -> {0 <= tMv <= t1, 0 <= t <= 2}];
intExp2 = Integrate[(1 + Exp[-2 intY2])/2, {u, tMv, t},  
                    Assumptions -> {0 <= tMv <= t1, 0 <= t <= 2}];

result1 = Integrate[intExp1 /. myConditions, {t, v, t1 + v}, 
                    Assumptions -> myAssum];
result2 = Integrate[intExp2 /. myConditions, {t, v, t1 + v}, 
                    Assumptions -> myAssum];

Check :

(result == result1 + result2 ) // Simplify
(* True *)
$\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.