Inequalities (unequal)
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
x <> y
_unequal(x
,y
)
x <> y
defines an inequality.
x <> y
is equivalent to the function
call _unequal(x, y)
.
The operator <>
returns a symbolic
expression representing an inequality.
The resulting expression can be evaluated to TRUE
or FALSE
by
the function bool
.
It also serves as control conditions in if
, repeat
, and while
statements. In all these cases,
testing for equality or inequality is a purely syntactical test. For
example, bool(0.5 <> 1/2)
returns TRUE
although
both numbers coincide numerically. Further, Boolean expressions can
be evaluated to TRUE
, FALSE
,
or UNKNOWN
by
the function is
.
Tests using is
semantically
compare x
and y
applying mathematical
considerations.
Inequalities have two operands: the left side and the right
side. Use lhs
and rhs
to extract these
operands.
The boolean expression not x = y
is always
converted to x <> y
.
The expression not x <> y
is always
converted to x = y
.
In the following example, note the difference between syntactical
and numerical equality. The numbers 1.5 and
coincide
numerically. However, 1.5 is
of domain type DOM_FLOAT
, whereas
is
of domain type DOM_RAT
.
Consequently, they are not regarded as equal in the following syntactical
test:
1.5 <> 3/2; bool(%)
The following expressions coincide syntactically:
_unequal(1/x, diff(ln(x),x)); bool(%)
The Boolean operator not
converts
equalities and inequalities:
not a = b, not a <> b
In this example, use the operator <>
to
compare two tables:
bool(table(a = PI) <> table(a = sqrt(2)))
Test equality of these expressions by using the syntactical
test via bool
and
the semantical test via testeq
:
bool(1 <> x/(x + y) + y/(x + y)), testeq(1 <> x/(x + y) + y/(x + y))
Inequalities are typical input objects for system functions,
such as solve
:
solve(x^2  2*x <> 1, x)

Arbitrary MuPAD^{®} objects 
Expression of type "_unequal"
.