Inconsistent results from "int" function

1 view (last 30 days)
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!

Accepted Answer

Alan Stevens
Alan Stevens on 27 Nov 2022
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 Comments
Torsten
Torsten on 27 Nov 2022
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 on 27 Nov 2022
Oh, sure. Thanks for the correction!

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!