Wrong integration result with R2011b

I get a wrong result with R2011b when doing the folloing integration:
>> syms x
>> syms a
>> int(x/2+sin(2*a*x)/(4*a),x)
ans =
x^2/4 - cos(a*x)^2/(4*a^2)
>> int(x/2,x) + int(sin(2*a*x)/(4*a),x)
ans =
x^2/4 - cos(2*a*x)/(8*a^2)
So the second result is the correct one, the first is wrong (when transforming the second result to the form of the first one there is a -1/(8*a^2) missing). When using R2010b I get the correct result when calculating int(x/2+sin(2*a*x)/(4*a),x). Is this a bug in R2011b?

댓글 수: 1

Jan
Jan 2012년 3월 27일
Does this mean, that you are missing a constant expression after calculatingthe integral?

댓글을 달려면 로그인하십시오.

 채택된 답변

Alexander
Alexander 2012년 3월 27일

0 개 추천

Both answers are correct. Let me quote Wikipedia's entry for Constant of integration:
In calculus, the indefinite integral of a given function (i.e., the set of all antiderivatives of the function) is only defined up to an additive constant, the constant of integration.
Since -1/(8*a^2) does not depend on x it is just another constant of integration. You can also verify this if you derive both results with respect to x.

추가 답변 (1개)

Daniel
Daniel 2012년 3월 27일

0 개 추천

Yes, you are right, I didn't take that into account, thanks!
Still, I find it strange, that there are different results for different version, but now that I recognized that everything is fine, I can live with it.

카테고리

질문:

2012년 3월 27일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by