Equal

lhs == rhs evaluates to True or False if equality or inequality is known.

Attributes[Equal] := {Protected}

Simple examples

Expressions known to be equal will evaluate to True:

In[1]:= 9*x==x*9
Out[1]= True

Sometimes expressions may or may not be equal, or Expreduce does not know how to test for equality. In these cases, the statement will remain unevaluated:

In[2]:= 9*x==x*10
Out[2]= (9*x == 10*x)

Equal considers Integers and Reals that are close enough to be equal:

In[3]:= tmp=5
Out[3]= 5
In[4]:= tmp==5
Out[4]= True
In[5]:= tmp==5.
Out[5]= True
In[6]:= tmp==5.00000
Out[6]= True

Equal can test for Rational equality:

In[7]:= 4/3==3/2
Out[7]= False
In[8]:= 4/3==8/6
Out[8]= True

Further examples

In[1]:= If[xx == 2, yy, zz] == If[xx == 2, yy, zz]
Out[1]= True

Equal does not match patterns:

In[2]:= {1, 2, 3} == _List
Out[2]= {1, 2, 3} == _List

This functionality is reserved for MatchQ:

In[3]:= MatchQ[{1, 2, 3}, _List]
Out[3]= True