using relational operators with the symbolic math toolbox?

2 views (last 30 days)
is there anyway i can use relational operators with the symbolic math toolbox? i have read the other answer for the same question and it wasn't very clear to me. could someone please explain?

Accepted Answer

Walter Roberson
Walter Roberson on 19 Feb 2011
Yes, there is a MuPad call named "is" that will test a condition. It is not strictly constrained to numeric relations: it can test properties such as data types, and when assumptions have been applied, it may be able to decide relationships between expressions that involve symbolic variables. Most of the time, though, expressions that involve symbolic variables without assumptions are not decidable, and is() will return false for those cases.
Coding the relational expression at the Matlab level can be a problem, so you usually end up having to express it as a string and using subs() to transfer the values from the Matlab engine to the symbolic engine.

More Answers (1)

Andrew Newell
Andrew Newell on 19 Feb 2011
If you have assigned numeric values to your symbolic variables, you could do something like this:
syms x y
x = 1; y = 2;
if double(y) > double(x)
disp('True is true!')
else
disp('Doubleplusungood.')
end

Community Treasure Hunt

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

Start Hunting!