XOR

Author

Eric W. Weisstein
April 19, 2011

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Logic/XOR.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/XOR.html.

©2011 Wolfram Research, Inc. except for portions noted otherwise

Definition

?Xor

Truth Table

With[{op=Xor},Grid[Prepend[Append[#,op@@#]&/@Flatten[Outer[List,{True,False},{True,False}],1],{A,B,op[A,B]}],Dividers->All]/.{True->"T",False->"F"}]//TraditionalForm

With[{op=Xor},Grid[Prepend[Append[#,op@@#]&/@Flatten[Outer[List,{True,False},{True,False},{True,False}],2],{A,B,C,op[A,B,C]}],Dividers->All]/.{True->"T",False->"F"}]//TraditionalForm

Decomposition

LogicalExpand[Xor[a,b]]//FullForm

LogicalExpand[And[Or[a,b],Or[Not[a],Not[b]]]]==LogicalExpand[Xor[a,b]]

BitXor

ListDensityPlot[Table[BitXor[x,y],{x,-31,31},{y,-31,31}],ColorFunction->Hue,
FrameLabel->TraditionalForm/@{x,y},
PlotLabel->TraditionalForm@BitXor[x,y],
Mesh->False,
FrameTicks->Join[Table[Transpose[{Range[1.5,63,10],Range[-30,31,10]}],{2}],{{}},{{}}]
]

3-D surface

From J.  Rangel-Mondragon, J.  "A Catalog of Cellular Automata."  MathSource  item 0211-521.