This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Equal


returns True if lhs and rhs are identical.
  • is used to represent a symbolic equation, to be manipulated using functions like Solve.
  • returns True if lhs and rhs are ordinary identical expressions.
  • returns False if lhs and rhs are determined to be unequal by comparisons between numbers or other raw data, such as strings.
  • Approximate numbers with machine precision or higher are considered equal if they differ in at most their last seven binary digits (roughly their last two decimal digits).
  • For numbers below machine precision the required tolerance is reduced in proportion to the precision of the numbers.
  • gives True if all the are equal.
  • For exact numeric quantities, Equal internally uses numerical approximations to establish inequality. This process can be affected by the setting of the global variable $MaxExtraPrecision.
Test equality:
Represent an equation:
Test equality:
In[1]:=
Click for copyable input
Out[1]=
 
Represent an equation:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
Test equality of numbers:
Approximate numbers that differ in their last seven 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 disprove equality:
Proving equality requires symbolic methods:
Symbolic methods used by Equal are insufficient to prove this equality:
Use RootReduce to decide whether two algebraic numbers are equal:
Numeric methods used by Equal do not use sufficient precision to disprove this equality:
RootReduce proves that the two algebraic numbers are not equal:
Increasing $MaxExtraPrecision may also allow you to disprove equality:
A symbolic identity:
Equal does not automatically prove this identity:
Use Expand to prove it:
A symbolic equation:
Use Solve to solve the equation:
Reduce gives all solutions, including the ones that require nongeneric values of parameters:
Compare more than two expressions:
Compare lists:
Compare strings:
The negation of two-argument Equal is Unequal:
The negation of three-argument Equal does not simplify automatically:
Use LogicalExpand to express it in terms of two-argument Unequal:
The negation of three-argument Equal is not equivalent to three-argument Unequal:
Equal tests mathematical equality of objects represented by expressions:
SameQ tests syntactic equality of expressions:
When Equal cannot decide whether two numeric expressions are equal it returns unchanged:
FullSimplify uses exact symbolic transformations to prove the equality:
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:
Use Solve to solve equations for generic values of parameters:
Reduce gives all solutions, including those with nongeneric parameter values:
Use Reduce to solve equations over specified domains:
Equality 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 Equal knows to look only at the first ten digits:
In this case, the equality test for machine numbers succeeds:
The extra digits in this case are ignored by Equal:
Equality may not be transitive for approximate numbers:
Equal is not treated as the Boolean equivalence operator:
Use Equivalent instead:
New in 1 | Last modified in 6