MATLAB: Very basic problem with using isAlways

isalwayssymbolic math

I'm trying to learn to use the symbolic math functionality and I was playing around with isAlways. I ran the following commands: a=sym('a','real'); b=sym('b','real');
isAlways(a>b|a==b|a<b)
ans=1
isAlways(a>=b|a<b)
ans=1
isAlways(a>=b|a<=b)
ans=0
I'm not entirely sure what I'm doing wrong but I really did expect the last statement to be true as well. Any thoughts?
Thanks a lot!

Best Answer

It could be that isAlways can't determine the validity of the inequalities. From isAlways, check the validity of this inequality. When isAlways cannot determine whether the condition is valid, it returns logical 0 by default. (See their example for this.)
Also from the same link, to change this default behavior, use Unknown. For example, specify that isAlways must return logical 1 if it cannot determine the validity of this inequality...Instead of true, you can also specify error. In this case, isAlways will throw an error if it cannot determine the validity of the condition.
Try the following
sAlways(a>=b|a<=b,'Unknown','error')
and observe the results. If an error is thrown, then the function can't determine the validity.