I have a function f(x)
and I want to define a new function g(x)
that is equal to f(x)
only when f(x)
is positive.
What is the right way to do that?
Sorry for this silly question, but I cannot find the proper way to accomplish this simple task in Mathematica.
g[x_]:=Max[f[x],0]
? (Provided I correctly remember the syntax of Max). But what should be the value of your new function when f is not positive? Is the zero value important? $\endgroup$g(x)
was undefined whenf(x)
was negative. $\endgroup$g(x)
is defined only for positivex
, instead I want that it is defined only whenf(x)
is positive. $\endgroup$