Checking whether a symbolic expression is an equality or inequality?

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

Accepted Answer

Walter Roberson
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)

More Answers (0)

Community Treasure Hunt

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

Start Hunting!