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.

I'm trying to calculate the following integral using Mathematica 9.0.1.0

 a11=Integrate[Abs[Sin[b+x]],{x,0,2*\[Pi]}]

This should be a simple problem; however, it took Mathematica a very long time to obtain the answer, which is 4. I asked a colleague to do it with Maple, the answer is obtained instantly. I thought may be this has something to do with the fact that Mathematica treats everthing as Complex value, so I rewrote the programm as

a1=Integrate[Abs[Sin[b+x]],{x,0,2*\[Pi]},Assumptions->{Element[{b,x},Reals]}]

Unfortunately, it took Mathematica even more time to run this command. What's more unfortunate is that the obtained answer is wrong:

4 Abs[Sin[b]] Cot[b]

Does anybody know what's wrong here?

share|improve this question
    
It's even more unfortunate that Integrate[Abs[Sin[b + x]], {x, 0, 2 Pi}, Assumptions -> {b \[Element] Reals}] returns 0 for me. –  b.gatessucks May 4 '13 at 14:38
    
@b.gatessucks. I tried your way, it returns 0, too. Is this a BUG? –  user2256793 May 4 '13 at 14:48
    
Yes, I think so. –  b.gatessucks May 4 '13 at 14:56
    
It does seem to be one. I've tagged appropriately. (For fun, see what happens if you use assumptions like b > 0 or b < 0, or some finite interval.) –  J. M. May 4 '13 at 15:17
add comment

2 Answers

up vote 1 down vote accepted
FullSimplify@ Integrate[Abs@Sin[b + x] , {x, 0, 2 Pi},   Assumptions -> {0 < b < 2 Pi}]

(*
 4
*)
share|improve this answer
add comment
In[77]:= $Version

Out[77]= "9.0 for Microsoft Windows (64-bit) (January 25, 2013)"

In[73]:= Timing[All = Integrate[Abs[Sin[b + x]], {x, 0, 2*\[Pi]}]]


Out[73]= {81.073720, 4}

In[75]:= Timing[
 FullSimplify@
  Integrate[Abs@Sin[b + x], {x, 0, 2 Pi}, 
   Assumptions -> {0 < b < 2 Pi}]]

(*4*)


Out[75]= {1.404009, 4}
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.