Re: NonlinearFit of an "implicit" function
- To: mathgroup at smc.vnet.net
- Subject: [mg94363] Re: NonlinearFit of an "implicit" function
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Thu, 11 Dec 2008 03:44:55 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <gho399$77$1@smc.vnet.net>
kretch wrote:
> I need to perform a non linear fit of a function which is not provided
> directly i.e. instead of the function having the explicit form
> f(x,y,z) = ...
> I have an implicit form
> 1/(f(x,y,z) + x^2)^3 = ...
>
> Now, I know I can manipulate the function so that I get an explicit
> form, but since I have a variety of functions (>100), this would be
> very tedious and error-prone.
>
> So my question is this:
> I'd like to get the explicit form of the function by "Solve" ing it,
> then run the fit on the explicit form. But for some reason, the exact
> syntax eludes me and I get error messages.
Say that the implicit equation is imp = 1/(f[x, y, z] + x^2)^3 == x y z,
then you can evaluate Solve[imp, f[x, y, z]] to get the solution(s), if
it exists, in explicit form.
Now, automatizing the process might be really difficult: below are
several points to keep in mind.
.1 In general, several functions are required in explicit form to
describe the curve. For instance, here is the equation of a circle of a
radius one, centered at the origin. (One implicit form, but two explicit
forms.)
In[1]:= imp = x^2 + f[x]^2 == 1;
Solve[imp, f[x]]
Out[2]= {{f[x] -> -Sqrt[1 - x^2]}, {f[x] -> Sqrt[1 - x^2]}}
.2 The conversion is not always feasible.
In[3]:= imp = Exp[x*f[x]] + Sqrt[x + f[x]] == 1;
Solve[imp, f[x]]
During evaluation of In[3]:= Solve::tdep: The equations appear to \
involve the variables to be solved for in an essentially \
non-algebraic way. >>
Out[4]= Solve[E^(x f[x]) + Sqrt[x + f[x]] == 1, f[x]]
.3 You can also get complex-valued functions.
In[5]:= imp = 1/(f[x, y, z] + x^2)^3 == c;
Solve[imp, f[x, y, z]]
Out[6]= {{f[x, y, z] ->
1/c^(1/3) - x^2}, {f[x, y, z] -> -((1 - I Sqrt[3])/(2 c^(1/3))) -
x^2}, {f[x, y, z] -> -((1 + I Sqrt[3])/(2 c^(1/3))) - x^2}}
> Can somebody share an example of fitting an implicit function?
>
> Thanks
> Kretch
>
>
Regards,
-- Jean-Marc