Question: Expressions as conditions for Piecewise functions

Hello,

Why does the following work as expected...

f__c := proc (x__0, y__0) options operator, arrow; piecewise(x__0^2+y__0^2 <= 1 and (x__0-1)^2+y__0^2 <= 1 and x__0^2+(y__0-1)^2 <= 1 and (x__0-1)^2+(y__0-1)^2 <= 1, 1, not (x__0^2+y__0^2 <= 1 and (x__0-1)^2+y__0^2 <= 1 and x__0^2+(y__0-1)^2 <= 1 and (x__0-1)^2+(y__0-1)^2 <= 1), 0) end proc

But the following does not?

cnd := x__0^2+y__0^2 <= 1 and (x__0-1)^2+y__0^2 <= 1 and x__0^2+(y__0-1)^2 <= 1 and (x__0-1)^2+(y__0-1)^2 <= 1
f__c := proc (x__0, y__0) options operator, arrow; piecewise(cnd, 1, not cnd, 0) end proc

(Sorry about the lack of formatting, the forum insists my Maple syntax is invalid)

The first one produces the expected result, x__0 and y__0 are treated as variables in the condition (i.e. f__c(a, b) returns the same piecewise function with x__0 replaced with a and y__0 replaced with b); the second one does not (i.e. f__c(a, b) returns the piecewise function, still with x__0 and y__0 in the condition, and never gets evaluated).

Please Wait...