Question: procedure with if statement

I have a question with a proc containing "if" statement. 
i want maple to do the calculations without just like Heaviside function does. how can it be done?is it possible?

restart

f1:=proc(x)
if x>=0 then 1
else 0
fi:end proc:

Matrix(2,[[f1(x)+2,2*f1(x)],[5,4]]);

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

 

P:=f1(x)*exp(x)+5*x;

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

 

diff(P,x)

0

(1)

 

 


but i can do all of the above with Heaviside(x). can i do the same with my procedure?

Download if.mw

Please Wait...