| Author |
Comment/Response |
Bill Simpson
|
03/26/12 4:06pm
If your actual problem has many, but equally simple, pieces then this might work for you.
In[1]:= y[x_]=Piecewise[{{x-1,-2<=x<0},{x+1,0<=x<2}}];
In[2]:= x[y_]=Piecewise[Map[{Last[#[[2]]],#[[1]]}&, List@@List@@@Reduce[y[x]==a && a∈Reals && -2<x<2,x]]/.a->y];
Now test this by inspection of
In[3]:= Plot[y[x],{x,-2,2}]
In[4]:= Plot[x[y],{y,-3,3}]
What that does is take apart your Piecewise, use Reduce to find each of the inverses and then put those back together to create a new Piecewise.
If your pieces are more complicated then I am concerned that this may not work and may not give you warnings when it doesn't.
URL: , |
|