I am trying to do the following (it's a simplified version):
In[1]:= rulepositive = { f[a_?Positive]:> f[a] };
In[2]:= rulenegative = { f[a_?Negative]:> 0 };
In[3]:= $Assumptions = Elements[w,Positive];
In[4]:= f[w]/.rulepositive
In[5]:= f[w]/.rulenegative
where I expect
Out[4]:= f[w]
Out[5]:= 0
But it doesn't work. In words I want to apply a set of mapping rules in functions with non numeric arguments, which nevertheless have definite nature (e.g. Positive/Negative). How could I do it?
Piecewise? – vi pa Mar 22 '20 at 10:00f[a_]:=Piecewise[{{Unevaluated[f[a]],a > 0},{0, a < 0}}]– vi pa Mar 22 '20 at 13:48