Checking whether a symbolic expression is an equality or inequality?
1 view (last 30 days)
Show older comments
Santiago
on 10 Feb 2016
Commented: Walter Roberson
on 10 Feb 2016
I have the following code involving symbolic variables and symbolic equations:
a = sym;
eqn1 = a <= 10;
eqn2 = a == 10;
I would like to check (programmatically) that the symbolic object in eqn1 represents an inequality (less than) and eqn2 represents an equality. Is possible to do so?
Thanks!
0 Comments
Accepted Answer
Walter Roberson
on 10 Feb 2016
char(feval(symengine, 'op', eqn1, 1))
The defined relationship operators are _equal, _unequal, _approx, _less, and _leequal . A>B is rewritten as _less(B,A) and A>=B is rewritten as _leequal(B,A)
2 Comments
More Answers (0)
See Also
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!