assume(x^2 == y) doesn't work
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Tommy
le 18 Mai 2020
Modifié(e) : Tommy
le 19 Mai 2020
"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 commentaires
Voir également
Catégories
En savoir plus sur Assumptions dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!