Why does x(x+y) dy give a x^3 component?

4 ビュー (過去 30 日間)
Björn Werner
Björn Werner 2020 年 2 月 26 日
コメント済み: darova 2020 年 3 月 2 日
syms g(x,y) x y
g(x,y) = 2*x+y;
gx = int(g, x);
int(gx, y)
The function gx becomes x*(x+y), so far so good. But int(gx, y) returns:
(x*(x + y)^2)/2
- which has a x^3 component in x*(x+y)^2. How could this happen?
doc int
The documentation refers me to the sym page, which does not mention "int" or "diff". Integration works fine for g(x,y)=y, but I've not tested much else.
Thanks.
  2 件のコメント
darova
darova 2020 年 2 月 26 日
I want to know it too
Bob Thompson
Bob Thompson 2020 年 2 月 26 日
It seems to be an issue with factoring. If you expand gx into x^2 + x*y and conduct the integration you get (x*y*(2*x + y))/2, which my fading memory of integration says is correct.

サインインしてコメントする。

採用された回答

Koushik Vemula
Koushik Vemula 2020 年 3 月 2 日
Both answers are correct.
d/dy[ x*(x+y)^2/2 ] = d/dy[ (x^3)/2 + x^2*y + y^2*x/2 ] = x*(x + y)
d/dy[ x*y*(2*x+y))/2 ] = x*(x + y)
The ambiguity lies in the constant of integration. In the first case the constant of integration ends up being (x^3)/2.
If you really want to enforce that the constant of integration is zero then do:
int(gx,y,0,y)
In other words
int(x*(x+y),y,0,y)
  1 件のコメント
darova
darova 2020 年 3 月 2 日
Thank you

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumber Theory についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by