Question: Is true or false: Pi < 0

Hi,

I have this procedure:

f := proc(x) if x < 0 then x^2+1; else cos(x); end if; end proc:

When I calculate NLPSolve(f,-Pi..2*Pi); the result is good. In NLPSolve, f(Pi) or f(-Pi) are also calculated.

When I want to determine f(Pi), I have this error code:

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

Why ? 

I must change my procedure with adding "evalf" to get a result for f(Pi):

f := proc(x) if evalf(x) < 0 then x^2+1; else cos(x); end if; end proc:

Thanks in advance for any explanation

Please Wait...