assume(x^2 == y) doesn't work
2 ビュー (過去 30 日間)
古いコメントを表示
I have the following code:
syms x y;
assume(x^2 == y);
assume(x*y == y*x);
t = isequaln(x^2, y);
s = isequaln(x*y, y*x);
The value for t is 0, so it doesn't seem like isequaln(x^2, y) is working correctly. (The value for s is 1, so it seems like assume(x*y == y*x) is working fine.) I've also tried simplify(x^2 + y) and this just returns x^2 + y. So there must be some exception with assumptions that involve the same variable twice?
Any help would be appreciated. Thanks.
0 件のコメント
回答 (1 件)
Tommy
2020 年 5 月 18 日
編集済み: Tommy
2020 年 5 月 19 日
"assume is not additive. Instead, it automatically deletes all previous assumptions on the variables in condition."
Here is a simple test of isequaln and isAlways:
>> syms x y
>> assume(x^2 == y)
>> assumeAlso(x*y == y*x)
>> assumptions
ans =
[ x*y == x*y, x^2 == y]
>> isequaln(x*y,y*x)
ans =
logical
1
% (I'm guessing this is true because multiplication of complex numbers is commutative,
% not because of the above assumption.)
>> isequaln(x*x,y)
ans =
logical
0
>> isAlways(x*x==y)
ans =
logical
1
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Assumptions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!