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 CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by