Re: inverse function computation
- To: mathgroup at smc.vnet.net
- Subject: [mg31683] Re: [mg31660] inverse function computation
- From: BobHanlon at aol.com
- Date: Sat, 24 Nov 2001 16:43:54 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 2001/11/23 6:54:16 AM, gosia_sz at softhome.net writes:
>I'd like to do the following manipulation.
>Let f be a homeomorphism (known explicitly).
>I want Mathematica to compute its inverse f^{-1} and to use it
>for further computations and plots.
>I'm assuming here that f^{-1} is not explicit (take f(x)=x+0.2Sin[x] for
>instance).
>
>I'm not sure that Mathematica has an already built-in function; do you
>know
>any simple algorithm?
f[x_] := x + 0.75*Sin[x];
g[y_?NumericQ] := (x /. FindRoot[y == f[x], {x, y}]);
f /: f[g[y_]] := y;
f /: InverseFunction[f] := g;
g /: g[f[x_]] := x;
g /: InverseFunction[g] := f;
{f[g[x]], g[f[x]], InverseFunction[f][y], InverseFunction[g][x],
InverseFunction[f][f[x]], InverseFunction[g][g[y]]}
{x, x, g[y], x + 0.75*Sin[x], x, y}
Needs["Graphics`Colors`"];
Needs["Graphics`Graphics`"];
Plot[{f[x], g[x], f[g[x]]}, {x, 0, 4Pi}, Ticks -> {PiScale, Automatic},
PlotStyle -> {Blue, Red, Green}];
Bob Hanlon
Chantilly, VA USA