@sym
: logical (eq) ¶Test if expression is "structurally" true.
This should probably be used with if/else flow control.
Example:
syms x y logical(x*(1+y) == x*(y+1)) ⇒ 1 logical(x == y) ⇒ 0
Note this is different from isAlways
which tries to
determine mathematical truth:
isAlways(x*(1+y) == x+x*y) ⇒ 1 logical(x*(1+y) == x+x*y) ⇒ 0
Sometimes we end up with a symbolic logical values; logical
can convert these to native logical values:
sym(true) ⇒ ans = (sym) True logical(ans) ⇒ ans = 1
logical
treats objects according to:
@logical
true/false: as is.
See also: @sym/isAlways, @sym/isequal, @sym/eq.
Package: symbolic