Boolean constant TRUE
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
MuPAD® uses a three state logic with the Boolean constants
The Boolean constants
of domain type
See and, or, not for the logical rules of the MuPAD three state logic.
(TRUE and (not FALSE)) or UNKNOWN
for reducing Boolean expressions such as equations or inequalities
to one of the Boolean constants:
bool(x = x and 2 < 3 and 3 <> 4 or UNKNOWN)
assume(x > 2): is(x^2 > 4), is(x^3 < 0), is(x^4 > 17)
Boolean constants occur in the conditional part of program control
structures such as
while statements. The
following loop searches for the smallest Mersenne prime larger than 500 (see
details). The function
its argument is a prime, and
FALSE otherwise. Once
a Mersenne prime is found, the
while-loop is interrupted by the
p := 500: while TRUE do p := nextprime(p + 1): if isprime(2^p - 1) then print(p); break; end_if; end_while:
if UNKNOWN then "true" else "false" end_if
Error: Unable to evaluate to Boolean. [if]