Inconsistent results from "int" function

3 ビュー (過去 30 日間)
YoungJoo Lee
YoungJoo Lee 2022 年 11 月 27 日
コメント済み: YoungJoo Lee 2022 年 11 月 27 日
Hi, everyone. For the same question, the "int" function provided me with different results.
syms x y
int(x*y/24+y^2/48,x)
int((y*(2*x + y))/48,x)
The second line gave me "(x*y*(x + y))/48" which was what I originally wanted,
but the third line gave me "'(y*(2*x + y)^2)/192" which is wrong.
Can anyone explain the reason?
Thanks for your time and help in advance!

採用された回答

Alan Stevens
Alan Stevens 2022 年 11 月 27 日
You can express '(y*(2*x + y)^2)/192 as (x*y*(x + y))/48+y^3/198
As far as the integral is concerned y is a constant, so the two results are the same to within a constant, which is all you can guarantee from an integral with no specific limits.
  5 件のコメント
Torsten
Torsten 2022 年 11 月 27 日
I believe, for my problem, providing something like "(x*y*(x + y))/48+C (where C is a constant)" as output would be more appropriate.
"(x*y*(x + y))/48+C(y) (where C is a function solely depending on y)"
YoungJoo Lee
YoungJoo Lee 2022 年 11 月 27 日
Oh, sure. Thanks for the correction!

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by