Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how

Legacy Documentation

Mathematica 8 (2010)

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

Relational and Logical Operators

x==y equal (also input as x y)
x!=y unequal (also input as x y)
x>y greater than
x>=y greater than or equal to (also input as x y)
x<y less than
x<=y less than or equal to (also input as x y)
x==y==z all equal
x!=y!=z all unequal (distinct)
x>y>z, etc. strictly decreasing, etc.

Relational operators.

This tests whether is less than . The result is False .
Out[1]=
Not all of these numbers are unequal, so this gives False .
Out[2]=
You can mix and .
Out[3]=
Since both of the quantities involved are numeric, Mathematica can determine that this is true.
Out[4]=
Mathematica does not know whether this is true or false.
Out[5]=
!p not (also input as p)
p&&q&&... and (also input as p q ... )
p||q||... or (also input as p q ... )
Xor[p,q,...] exclusive or (also input as p q ... )
Nand[p,q,...] and Nor[p,q,...] nand and nor (also input as and )
If[p,then,else] give then if p is True , and else if p is False
LogicalExpand[expr] expand out logical expressions

Logical operations.

Both tests give True , so the result is True .
Out[6]=
You should remember that the logical operations , and are all double characters in Mathematica. If you have used a programming language such as C, you will be familiar with this notation.
Mathematica does not know whether this is true or false.
Out[7]=
Mathematica leaves this expression unchanged.
Out[8]=
You can use LogicalExpand to expand out the terms.
Out[9]=


ja zh

AltStyle によって変換されたページ (->オリジナル) /