Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
Boolean Expressions
Description
Boolean expressions are formed by using the logical operators and, or, xor (exclusive disjunction), implies, and not, and the relational operators <, <=, >, >=, =, and <>.
In 2-D math, the relational operators <=, >=, and <> display as , , and .
For information on the order of precedence of these operators, see operators[precedence].
Maple uses three-valued logic for all of its Boolean operations. The special names true and false are used to represent logical truth and logical false. A third special name FAIL is used to represent an expression whose truth is unknown.
The evalb function evaluates its argument as a Boolean expression. For example, x = x is an algebraic equation in Maple and normally it is not treated as a Boolean expression. However, evalb(x = x) evaluates to true.
Evaluation as a Boolean expression takes place automatically if the expression:
contains a logical operator,
is in the if clause of a conditional statement, or
is in the while clause of a repetition statement.
The following type names are used: `=`, `<>`, `<`, `<=`, relation (means any of the preceding four), `and`, `or`, `xor`, `implies`, `not`, and logical (means any of the preceding five).
The type boolean is defined to be any of the above or the special names true, false, and FAIL.
Note: In 1-D Math notation, the boolean type names must be enclosed in left quotes (` `) as above. In 2-D Math notation, left quotes are not necessary.
Note: Expressions that use the operators > and >= are automatically converted to expressions of type `<` and `<=`, respectively.
The evaluation of expressions involving the logical operators uses the McCarthy evaluation rules. Namely, the left operand of the four operators and, or, xor, implies is always evaluated first, and the evaluation of the right operand is avoided if the truth value of the expression can be deduced from the value of the left operand alone. For example, the construct
does not cause a division by zero error because if , then the left operand of and becomes false and the right operand of and will not be evaluated.
The evaluation of a Boolean expression yields true, false, or FAIL according to the following table.
and
or
not
true
false
FAIL
xor
implies
Thread Safety
The boolean operators are thread safe as of Maple 15.
For more information on thread safety, see index/threadsafe.
Examples
See Also
equation, evalb, Logic, operators[precedence], type, type/boolean, type/logical, type/truefalse
Download Help Document