I would like to convert a piecewise defined function of two variables into an if structure
F := (x,y) -> piecewise(x < 0, piecewise(y < 0, 0, 1), piecewise(y < 0, 1, 0));
What I expect is something like (the indentation is just for fun)
if x < 0 then
if y < 0 then 0 else 1 end if;
if y < 0 then 1 else 0 end if;
I tried the following :
convert(F(x,y), `if`) # but it only converts the "outer x condition" and keeps the "inner y conditions" unchanged
And next this :
map(u -> convert(u, `if`), F(x,y)): # fails to give m
map(u -> convert(u(x,y), `if`), F(x,y)):
Can anoybody help me please.
I am also interested in an explanation of the reasons why the previous command do not work.