Reputation: 375
Is there a way to define a function on a specific domain in mathematica? I need this because I want to invert a function which is only monotonic on a specific domain.
For example:
f[x_]:=x^2
g[x_]:=InverseFunction[f][x]
will give me $Failed report. This is because the parabolic function is only monotonic on x>0 or x<0. Is there a way to specify this when defining the function?
Thanks!
Upvotes: 2
Views: 2552
Reputation: 8655
This works for your example.
f[x_ /; x != 0] := x^2
g[y_] := InverseFunction[f][y]
Plot[g[z], {z, -2, 2}]
Upvotes: 3