First time here? Check out the FAQ!

Ask Your Question
1

I don't know why Sage return 0 for integrate(sin(2*x).abs(),(x,0,pi)) when its value is 2

asked 10 years ago

Arturo gravatar image

updated 2 years ago

tmonteil gravatar image

When I try integrate(sin(x).abs(),(x,0,pi)) the program return the same thing. The numerical integration is correct, the program return (1.9999999999999998, 2.220446049250313e-14). I don't know if it is a bug or what. Any help? I have tried sage 6.2, 6.3, 6.4.1

Mathematica can do It without any problem http://www.wolframalpha.com/input/?i=...

Neither Sympy nor Maxima can't compute this.

Preview: (hide)

3 Answers

Sort by » oldest newest most voted
1

answered 10 years ago

tmonteil gravatar image

They are indeed some issues with integrals involving absolute values, see a list here At least in your case no wrong answer is returned.

Preview: (hide)
link

Comments

@tmonteil: The question's title suggests that a wrong answer is indeed returned, even if the text of the question counterbalances that by the fact that numerical integration is correct.

slelievre gravatar imageslelievre ( 10 years ago )
0

answered 10 years ago

kcrisman gravatar image

Interestingly,

sage: integrate(abs(sin(x)),x)
-(2*arctan(sin(x)/(cos(x) + 1))*sin(x)/(cos(x) + 1) - log(2))*sgn(1/(cos(x) + 1))*sgn(sin(x)) - log(2*sin(x)^2/(cos(x) + 1)^2 + 2)*sgn(1/(cos(x) + 1))*sgn(sin(x)) + log(sin(x)^2/(cos(x) + 1)^2 + 1)*sgn(1/(cos(x) + 1))*sgn(sin(x)) + 2*(sin(x)/((sin(x)^2/(cos(x) + 1)^2 + 1)*(cos(x) + 1)) + arctan(sin(x)/(cos(x) + 1)))*abs(sin(x))/abs(cos(x) + 1)

Not that this is all that useful, because if we call this f then f(pi) has division by zero error, and based on comments elsewhere it is probably wrong in any case. I have to admit I am surprised this isn't doable, though. See this ticket 17511 but there are lots of places this question has recurred.

Preview: (hide)
link
0

answered 10 years ago

marguin gravatar image

With Sage-4.7, integrate(abs(sin(t)),t,0,pi) returns 2 as expected.

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 10 years ago

Seen: 1,135 times

Last updated: Feb 03 '15