Error, cannot determine if this expression is true or false: 1/10000000000 < 1.*abs((e^.1-0.8983341665e-1)/(e^.1*ln(e)-.7950041653)) - Maple Help

Home : Support : Online Help : Error, cannot determine if this expression is true or false: 1/10000000000 < 1.*abs((e^.1-0.8983341665e-1)/(e^.1*ln(e)-.7950041653))

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

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

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

Examples

Example 1

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}{≔}{\mathbf{proc}}\left({x}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{x}{<}{0}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{then}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{x}{^}{3}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{else}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{x}{^}{2}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (2.1)
 > $\mathrm{plot}\left(f\left(x\right),x=-1..1\right)$
 > $\mathrm{evalf}\left(\mathrm{Int}\left(f\left(x\right),x=-1..1\right)\right)$
 > $\mathrm{fsolve}\left(f\left(x\right)=-1,x\right)$

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.

Solution 1

Here we use unevaluation quotes around $f$. For details, see Unevaluated Expressions.

 > $\mathrm{plot}\left('f'\left(x\right),x=-1..1\right)$

Solution 2

Here, we supply the operator form to the plot function.  (Note it is $f$ not $f\left(x\right)$ in the first argument to plot.)

 > $\mathrm{plot}\left(f,-1..1\right)$

Solutions for the fsolve and evalf/Int problems

 > $\mathrm{fsolve}\left('f'\left(x\right)=-1,x\right)$
 ${-}{1.000000000}$ (2.2)
 > $\mathrm{fsolve}\left('f'\left(x\right),x=-1..1\right)$
 ${0.}$ (2.3)
 > $\mathrm{evalf}\left(\mathrm{Int}\left(f,-1..1\right)\right)$
 ${0.08333333333}$ (2.4)
 > $\mathrm{evalf}\left(\mathrm{Int}\left('f'\left(x\right),x=-1..1\right)\right)$
 ${0.08333333333}$ (2.5)

Example 2

In this example, we want to use a loop to find primes less than 15.  The error happens because i needs an initial value.

 > $\mathbf{do}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}i\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathbf{until}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}15<\left(i≔\mathrm{nextprime}\left(i\right)\right)$
 ${i}$

Solution 1

Before beginning the loop, assign i to a starting value.

 > $i≔2$
 ${i}{≔}{2}$ (2.6)
 > $\mathbf{do}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}i\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathbf{until}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}15<\left(i≔\mathrm{nextprime}\left(i\right)\right)$
 ${2}$
 ${3}$
 ${5}$
 ${7}$
 ${11}$
 ${13}$ (2.7)

Solution 2

Alternatively, use the from clause to set a starting value.

 > $\mathrm{restart}$
 >
 ${1}$
 ${3}$
 ${6}$
 ${8}$
 ${12}$
 ${14}$ (2.8)