PRODUCTS
Products Overview
Mathematica
Mathematica for Students
Mathematica Home Edition
Wolfram
CDF Player
(free download)
Computable Document Format (CDF)
web
Mathematica
grid
Mathematica
Wolfram
Workbench
Mathematica
Add-Ons
Wolfram|Alpha Products
SOLUTIONS
Solutions Overview
Engineering
Aerospace Engineering & Defense
Chemical Engineering
Control Systems
Electrical Engineering
Image Processing
Industrial Engineering
Materials Science
Mechanical Engineering
Operations Research
Optics
Petroleum Engineering
Biotechnology & Medicine
Bioinformatics
Medical Imaging
Finance, Statistics & Business Analysis
Actuarial Sciences
Data Analysis & Mining
Econometrics
Economics
Financial Engineering & Mathematics
Financial Risk Management
Statistics
Software Engineering & Content Delivery
Authoring & Publishing
Interface Development
Software Engineering
Web Development
Science
Astronomy
Biological Sciences
Chemistry
Environmental Sciences
Geosciences
Social & Behavioral Sciences
Design, Arts & Entertainment
Game Design, Special Effects & Generative Art
Education
STEM Education Initiative
Higher Education
Community & Technical College Education
Primary & Secondary Education
Students
Technology
Computable Document Format (CDF)
High-Performance & Parallel Computing (HPC)
See Also: Technology Guide
PURCHASE
Online Store
Other Ways to Buy
Volume & Site Licensing
Contact Sales
Software
Service
Upgrades
Training
Books
SUPPORT
Support Overview
Knowledge Base
Learning Center
Community & Forums
Training & Free Seminars
Does My Site Have a License?
Wolfram User Portal
COMPANY
About Wolfram Research
News & Events
Wolfram Blog
Partnerships
Employment Opportunities
History of
Mathematica
Stephen Wolfram's Home Page
Contact Us
OUR SITES
All Sites
Wolfram|Alpha
Demonstrations Project
MathWorld
Integrator
Wolfram Functions Site
Mathematica Journal
Wolfram Media
Wolfram
Tones
Wolfram Science
Stephen Wolfram
DOCUMENTATION CENTER SEARCH
New to
Mathematica
?
Find your learning path
»
Mathematica
>
BUILT-IN MATHEMATICA SYMBOL
Relational and Logical Operators
Tutorials »
|
Equal
UnsameQ
Order
See Also »
|
Conditionals
Inequalities
Language Overview
Logic & Boolean Algebra
Mathematica Syntax
Testing Expressions
More About »
Unequal
or
returns
False
if
lhs
and
rhs
are identical.
MORE INFORMATION
can be entered as
x
\[NotEqual]
y
or
Esc
!=
Esc
.
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
are equal.
False
.
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
.
EXAMPLES
CLOSE ALL
Basic Examples
(2)
Returns
True
if elements are guaranteed unequal, and otherwise stays unevaluated:
Enter as
!=
or as
Esc
!=
Esc
:
Returns
True
if elements are guaranteed unequal, and otherwise stays unevaluated:
In[1]:=
Out[1]=
Enter as
!=
or as
Esc
!=
Esc
:
In[1]:=
Out[1]=
Scope
(11)
Test unequality of numbers:
Approximate numbers that differ in at most their last eight binary digits are considered equal:
Compare an exact numeric expression and an approximate number:
Compare two exact numeric expressions; a numeric test may suffice to prove unequality:
Proving equality requires symbolic methods:
Symbolic methods used by
Unequal
are insufficient to prove this
False
:
Use
RootReduce
to decide whether two algebraic numbers are unequal:
Numeric methods used by
Unequal
do not use sufficient precision to prove this unequality:
RootReduce
proves that the two algebraic numbers are not equal:
Increasing
$MaxExtraPrecision
may also prove unequality:
This symbolic unequality is always
False
:
Unequal
does not automatically prove this unequality:
Use
Expand
to prove it:
Compare more than two expressions:
Compare lists:
Compare strings:
Properties & Relations
(4)
The negation of two-argument
Unequal
is
Equal
:
The negation of three-argument
Unequal
does not simplify automatically:
Use
LogicalExpand
to express it in terms of two-argument
Equal
:
The negation of three-argument
Unequal
is not equivalent to three-argument
Equal
:
Unequal
tests mathematical unequality of objects represented by expressions:
UnsameQ
tests syntactic unequality of expressions:
When
Unequal
cannot decide whether two numeric expressions are equal it returns unchanged:
FullSimplify
uses exact symbolic transformations to disprove the unequality:
PossibleZeroQ
uses numeric and symbolic heuristics to decide whether an expression is zero:
Numeric methods used by
PossibleZeroQ
may incorrectly decide that a number is zero:
Possible Issues
(3)
Unequality for machine-precision approximate numbers can be subtle:
The extra digits disrupt equality:
Arbitrary-precision approximate numbers do not have this problem:
Thanks to automatic-precision tracking,
Unequal
knows to look only at the first 10 digits:
In this case, the unequality test for machine numbers gives the expected result:
The extra digits in this case are ignored by
Unequal
:
SEE ALSO
Equal
UnsameQ
Order
TUTORIALS
Relational and Logical Operators
MORE ABOUT
Conditionals
Inequalities
Language Overview
Logic & Boolean Algebra
Mathematica
Syntax
Testing Expressions
New in 1 | Last modified in 3