!=

Inequality operator.

Syntax

expr_1 != expr_2

Operands

expr_1, expr_2
A pair of valid expressions.

Example

Expression Result
0 != 3 1
0 != sin(0) 0
1 != {1, 2, 3} 1
{1, 2, 3} != {4, 5, 6} 1
{1, 2, 3} != ( {4, 5, 6}-3) 0
{ {1, 2}, {3, 4} } != {1, 2, 3, 4} 1
{ {1, 0}, {0, 4} } != ( { {1, 0}, {0, 2} } ^2) 0
"hello" != "goodbye" 1
"abcd" != "ab" + "cd" 0
{"abc", "def"} != "abc" 1

Comments

The inequality operator compares two expressions to determine if they are of different types, dimensions, or values.

If expr_1 and expr_2 are equal, the result is zero.

If expr_1 and expr_2 are not equal, the result is one.

If expr_1 and expr_2 are of different types, they are unequal and the result is one.

If they are the same type: i.e., both are vectors, but have different dimensions, they are unequal and the result is one.

If they are of the same type with the same dimensions, but not all elements are equal, they are unequal and the result is one.

Some operating systems introduce round-off errors that can produce erroneous results. For instance, the calculated value of sqrt(25) and 5 might not be equal if the operating system evaluates the value of sqrt(25) to be 5.0000001.