evalb
evaluate as a Boolean expression
Calling Sequence
Parameters
Description
Thread Safety
Examples
evalb(x)
x
-
expression
The evalb command forces the evaluation of expressions involving relational operators, using a three-valued logic system. The return values are true, false, and FAIL. If evaluation is not possible, an unevaluated expression is returned.
Normally expressions containing the relational operators =, <>, <, <=, >, and >= are treated as algebraic equations or inequalities by Maple. However, when passed as arguments to the evalb command (or when appearing in a Boolean context in an if or while statement), they are evaluated to true or false if possible.
Note that expressions involving > and >= are converted into equivalent expressions involving < and <=, respectively.
An evalb call using <, <=, >, or >= returns evaluated only with arguments of type extended_numeric, complex, or string. For more on string comparisons, see the section Operations on Entire Strings in Using Strings in Maple.
Important: The evalb command does not simplify expressions. It may return false for a relation that is true. In such a case, apply a simplification to the relation before using evalb.
Important: The evalb command does not perform arithmetic for inequalities involving <, <=, >, or >=. It may return unevaluated when a relation is true. In such a case, perform the arithmetic operations before using evalb.
The evalb command is thread-safe as of Maple 15.
For more information on thread safety, see index/threadsafe.
x = x;
x=x
evalb(x=x);
true
evalb(x=y);
false
a:=2:
b:=2:
evalb(a=b);
evalb(Float(infinity)<infinity);
evalb(Float(undefined)<undefined);
evalb(Re(x)<>Re(x+1));
The evalb command cannot be used in some cases.
evalb(x>y);
y<x
evalb(2+3*I<3+4*I);
FAIL
In some cases, you must subtract the right-hand side from the left-hand side before evaluating inequalities that use <, <=, >, or >=.
evalb(Re(x)<Re(x+1));
ℜ⁡x<1+ℜ⁡x
evalb(Re(x)-Re(x+1)<0);
The evalb command uses address tests to determine equality.
evalb(Re(x)<=Re(x));
You must convert symbolic arguments to floating-point values when using the evalb command for inequalities that use <, <=, >, or >=.
evalb(sqrt(5)>2);
2<5
evalb(evalf(sqrt(5))>2);
Alternately, in this case you could use the is command to evaluate the boolean expression, without using evalf.
is(sqrt(5)>2);
The evalb command can be used in combination with any number of packages.
evalb(StringTools[Search]("2","This sentence does not contain any numbers.")=0);
The evalb command can be used to check if an equation has an x-term.
evalb(coeff(x^3+2*x^2-5,x)<>0);
evalb(coeff(x^3+2*x^2-5, x^2)<>0);
See Also
Boolean
is
testeq
type/complex
type/extended_numeric
Using Strings in Maple
Download Help Document
What kind of issue would you like to report? (Optional)