TITLE: root-finding methods to invert numerically a function
QUESTION [8 upvotes]: let be the equation $ y-f(x)=0 $ the idea is to get $ s=g(y) $ that is x as a function of 'y'
can this be made by a root finding algorithm ?? i mean you treat $ y $ as a numerical free parameter and find the roots of $ y-f(x)=0 $ in general these roots will depend on 'y' so we can represent every solution of $ y-f(x) $ for different parameters of 'y'
for example in Newton's method 
$ x_{n+1} (y)=x_{n} (y)- \frac{y-f(x)}{-f'(x)} $

REPLY [4 votes]: The inverse of a single-variable function is a reflection over the line $y = x$. If you want the numerical inverse, just flip the coordinates. For example,
Function:
y = f(x);
plot(x,y);

Inverse
y = f(x);
plot(y,x);