Error, (in ...) cannot determine if this expression is true or false: ... - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : System : Error Message Guide : cannotdetermineifthisexpression

Error, (in ...) cannot determine if this expression is true or false: ...

 

Description

Examples

See Also

Description

Maple cannot determine whether something is true or false in an if statement or while clause.

Examples

 A typical occurrence happens when a procedure that requires numeric arguments is called with symbolic arguments:

f:=proc&lpar;x&rpar;ifx<0thenx&Hat;3elsex&Hat;2endifendproc

f:=procxifx<0thenx&Hat;3elsex&Hat;2end ifend proc

(2.1)

plotfx&comma;x&equals; 1..1&semi;

Error, (in f) cannot determine if this expression is true or false: x < 0

evalfInt&lpar;fx&comma;x&equals;−1..1&rpar;&semi;

Error, (in f) cannot determine if this expression is true or false: x < 0

fsolvefx&equals;−1&comma;x&semi;

Error, (in f) cannot determine if this expression is true or false: x < 0

Solution:

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. For details, see uneval.

plot&apos;f&apos;x&comma;x&equals; 1..1&semi;

plotf&comma;1..1

fsolve&apos;f&apos;x&equals;1&comma;x

1.000000000

(2.2)

fsolve&apos;f&apos;x&comma;x&equals;1..1

0.

(2.3)

evalfIntf&comma;−1..1&semi;

0.08333333333

(2.4)

evalfInt&apos;f&apos;x&comma;x&equals;1..1&semi;

0.08333333333

(2.5)

See Also

  fsolve, Numerical integration,  plot , uneval


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam