Symbolic Integration

조회 수: 16 (최근 30일)
Jonathan
Jonathan 2011년 3월 12일
Hi everybody,
I have a little question about 'int' function. I have this code:
>> syms x y
>> int(x+y,x)
so I want to know why is this the result?:
ans =
(x + y)^2/2
instead of:
x^2/2+x*y
I'm a little confused about it, I hope you can help me understand.

채택된 답변

Teja Muppirala
Teja Muppirala 2011년 3월 12일
Both answers are correct.
d/dx[ (x+y)^2/2 ] = d/dx[ x^2/2 + x*y + y^2/2 ] = x + y
d/dx[ x^2/2 + x*y ] = x + y
The ambiguity lies in the constant of integration. In the first case the constant of integration ends up being y^2/2.
If you really want to enforce that the constant of integration is zero then do:
F = int(x+y,x,0,x)
expand(F)
  댓글 수: 1
Jonathan
Jonathan 2011년 3월 13일
Thank you, now I understand how the function works.

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2011년 3월 12일
Odd, I don't get that in Maple; unfortunately I don't have the Symbolic Toolbox to test with.

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by