[Date Index]
[Thread Index]
[Author Index]
Re: InverseFunction problem
*To*: mathgroup at smc.vnet.net
*Subject*: [mg5573] Re: InverseFunction problem
*From*: Daniel Lichtblau <danl>
*Date*: Fri, 27 Dec 1996 01:58:53 -0500
*Organization*: wolfram.com
*Sender*: owner-wri-mathgroup at wolfram.com
Pedro Santos wrote:
>
> Can someone help me with this?
> Consider the function f[x_]:=x/(1-x), clearly the inverse of
> this function is F[x_]:=x/(1+x).
> How do I get a numerical result for F[x] when f[x] is a more
> complicated
> function?
> In the above example F[2.1]=0.677419, but
> (-1)
> InverseFunction[f[2.1]]//N= (-1.90909)
> Am I doing something wrong? I want to make sure I can find a numerical
> result before I use this for a more complex task.
> Can someone help?
> Please reply via e-mail to psantos at sprintmail.com
> Thanks in advance.
>
> pedro santos..
InverseFunction will not find you a symbolic (or numeric) inverse to a
function unless explicitly provided for in the StartUp file
InverseFunctions.m. If you evaluate InverseFunction[f[2.1]] you just get
InverseFunction wrapped around the evaluation of f[2.1].
In[14]:= InverseFunction[f[2.1]]
Out[14]= InverseFunction[-1.90909]
To find a numeric inverse to f you might proceed as follows. Assume we
have an inverse function, call it g. Then f[g[x]] - x is zero. So we can
use a root finder to obtain the numerical inverse.
In[18]:= g[x_] := FindRoot[f[y]==x, {y,0}];
In[19]:= g[2.1]
Out[19]= {y -> 0.677419}
This method may have problems for discontinuous or multi-valued
functions, or may exhibit convergence problems (heavily influenced by
starting point for FindRoot). For your example there is a vertical
asymptote at x==1, and you can readily see that a different starting
point will be necessary for inverting negative values.
In[21]:= g[-2.1]
FindRoot::cvnwt:
Newton's method failed to converge to the prescribed accuracy after
15
iterations.
14
Out[21]= {y -> -2.37277 10 }
In[23]:= gNeg[x_] := FindRoot[f[y]==x, {y,2}] /; x<0;
In[24]:= gNeg[-2.1]
Out[24]= {y -> 1.90909}
In[25]:= (-2.1)/(1-2.1)
Out[25]= 1.90909
Daniel Lichtblau
Wolfram Research
danl at wolfram.com
Prev by Date:
**Re: Expand and NonCommutativeMultiply ?**
Next by Date:
**Re: Re EPS files produced by Mathematica 3.0**
Previous by thread:
**InverseFunction problem**
Next by thread:
**Eliminating line break characters**
| |