# Unequal

lhs!=rhs or lhsrhs

returns False if lhs and rhs are identical.

# Details

• can be entered as or x != y.
• lhsrhs returns True if lhs and rhs are determined to be unequal by comparisons between numbers or other raw data, such as strings.
• Approximate numbers are considered unequal if they differ beyond their last two decimal digits.
• gives True only if none of the ei are equal. 232->False.
• lhsrhs represents a symbolic condition that can be generated and manipulated by functions like Reduce and LogicalExpand.
• Unequal[e] gives True.
• For exact numeric quantities, Unequal internally uses numerical approximations to establish inequality. This process can be affected by the setting of the global variable \$MaxExtraPrecision.
• In StandardForm, Unequal is printed using .

# Background & Context

• Unequal[expr1,expr2] returns True if expr1 and expr2 are numerically unequal, False if they are equal and unevaluated if equality cannot be established. For example, Unequal[(1+Sqrt[5])/2,GoldenRatio] returns False, Unequal[1,2] returns True, and Unequal[1,a] returns unevaluated. Unequal[expr1,expr2] may be input as expr1!=expr2 or using the \[NotEqual] character as expr1expr2. The multiple-argument form Unequal[expr1,expr2,], which may also be input as expr1!=expr2!=, returns True if none of the expressions expri are numerically equal, False if any two are equal and unevaluated otherwise. The single-argument form Unequal[expr] returns True (as, slightly paradoxically, does the single-argument form Equal[expr]).
• Numbers with machine precision (MachinePrecision) or greater are considered equal if they differ in at most their last seven binary digits and unequal otherwise. Equality for numbers below machine precision is established based on agreement to within the precision of the lowest precision number. For example, 1.01`2!=1 returns False, while 1.01`3==1 returns True. For exact numeric quantities, Unequal uses numerical approximations to establish inequality, which can be affected by the value of the global variable \$MaxExtraPrecision.
• Unequal is related to a number of other symbols. UnsameQ[expr1,expr2] (which may be input as expr1=!=expr2) returns True if expr1 and expr2 differ in their underlying FullForm representations and otherwise returns False. In contrast to Unequal, UnsameQ differentiates between different representations of numbers; for example, UnsameQ[1,1.] and UnsameQ[1.,1.+0.I] both return True. The behavior of UnsameQ also differs from that of Unequal in that UnsameQ always evaluates to True or False, whereas Unequal may remain unevaluated in cases where equality cannot be resolved. Equal (which may be input as expr1==expr2) is the converse of Unequal. Unequal also has an operator form UnequalTo.
• PossibleZeroQ can be used to indicate if a given expression has value in some cases where Unequal returns unevaluated. For example, Unequal[Erf[Log[4]+2Log[Sin[Pi/8]]]-Erf[Log[2-Sqrt[2]]],0] returns evaluated, while calling PossibleZeroQ on its first argument returns True (together with an informative message indicating that a zero value could not be rigorously established). Symbolic simplifiers like Simplify, FullSimplify and RootReduce can sometimes also be used to rigorously establish equality (including in the example just given) when Unequal cannot.

# Examples

open allclose all

## Basic Examples(2)

Returns True if elements are guaranteed unequal, and otherwise stays unevaluated:

 In[1]:=
 Out[1]=

Enter as != or as !=:

 In[1]:=
 Out[1]=

# Tutorials

Introduced in 1988
(1.0)
| Updated in 1996
(3.0)