Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
    
Why all those separate Assuming functions? Can't you combine them? –  Sjoerd C. de Vries Jan 16 '13 at 20:11
    
The D you use as a variable is a reserved word. –  Sjoerd C. de Vries Jan 16 '13 at 20:13
    
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. –  Nicola Jan 16 '13 at 21:07
    
You have a k>0 which seems not needed. –  b.gatessucks Jan 17 '13 at 9:48
add comment

1 Answer 1

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 *)
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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