 The Constant FAIL - Maple Programming Help

The Constant FAIL

Description

 • FAIL is a Maple symbol which has several special properties.
 • FAIL is used by Boolean logic to mean an unknown or undetermined value.  When used inside Boolean expressions with and, or, and not, it behaves like standard three-valued logic.
 • Many functions return FAIL when they are unable to produce a definitive result. For example, is and testeq will return FAIL when it cannot be determined with certainty whether the value is true or false.
 • As a Boolean condition in an if or while statement or if expression, a FAIL has the same effect as a false. That is, the if will take the else branch and the while will stop the iteration.  Notice that when a FAIL value is possible,
 if expr then a else b end if;
 is not equivalent to
 if not expr then b else a end if;
 • Arithmetic with FAIL is valid but limited, and the value of FAIL is contagious over the basic arithmetic operations.  In other words, expressions such as 2 + FAIL, FAIL - FAIL, and FAIL/FAIL will all return FAIL.

Truth Table for Logical Operators

 • The evaluation of a logical expression yields true, false, or FAIL according to the following table.

 and or not true false FAIL true false FAIL true true false FAIL true true true false false false false false true false FAIL true FAIL FAIL false FAIL true FAIL FAIL FAIL

 xor implies true false FAIL true false FAIL true false true FAIL true false FAIL false true false FAIL true true true FAIL FAIL FAIL FAIL true FAIL FAIL

Examples

 > $\mathrm{true}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{and}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{FAIL},\mathrm{false}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{or}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{FAIL},\mathrm{FAIL},\mathrm{FAIL}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{or}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{true}$
 ${\mathrm{FAIL}}{,}{\mathrm{FAIL}}{,}{\mathrm{FAIL}}{,}{\mathrm{true}}$ (1)
 > $\mathrm{testeq}\left(\mathrm{LambertW}\left(x\right)-x\right)$
 ${\mathrm{FAIL}}$ (2)
 > $\mathrm{FAIL}-\mathrm{FAIL}$
 ${\mathrm{FAIL}}$ (3)
 > $\mathrm{is}\left(\mathrm{\gamma },\mathrm{rational}\right)$
 ${\mathrm{FAIL}}$ (4)