Error, cannot determine if this expression is true or false: ...
Error, (in ...) cannot determine if this expression is true or false: ...
Maple cannot determine whether something is true or false in an if statement or while clause.
A typical occurrence happens when a procedure that requires numeric arguments is called with symbolic arguments. Here are three examples with the same underlying problem:
f ≔ procx if x < 0 then x3 else x2 end if end proc
f≔procxifx<0thenx^3elsex^2end ifend proc
Error, (in f) cannot determine if this expression is true or false: x < 0
Maple evaluates the inputs to a procedure such as plot before it calls the procedure, resulting in f being called with the symbolic argument x. Since x has not yet been assigned a value, Maple cannot determine if x is less than 0. You can either delay the evaluation of the input using unevaluation quotes, or you can supply the arguments with operator form.
Here we use unevaluation quotes around f. For details, see Unevaluated Expressions.
Here, we supply the operator form to the plot function. (Note it is f not f⁡x in the first argument to plot.)
Solutions for the fsolve and evalf/Int problems
In this example, we want to use a loop to find primes less than 15. The error happens because i needs an initial value.
Error, cannot determine if this expression is true or false: 15 < nextprime(i)
Before beginning the loop, assign i to a starting value.
Alternatively, use the from clause to set a starting value.
for i from 1 doiuntil15<i≔nextprime⁡i
For more information about loops, see The Repetition Statement.
The Repetition Statement
Download Help Document