Re: FindFit and complex function?
- To: mathgroup at smc.vnet.net
- Subject: [mg80557] Re: FindFit and complex function?
- From: ben <benjamin.friedrich at gmail.com>
- Date: Sun, 26 Aug 2007 03:01:11 -0400 (EDT)
- References: <firstname.lastname@example.org>
Dear Michael, have you tried Chop to chop off tiny imaginary parts ? Can you use a constrained fit, to ensure that for all parameter choices the fitting function, say f, takes real values? Minimize Real[f] + If[ Chop[ Im[ f ] ] != 0, Infinity, 0] instead of f ? Bye Ben On 24 Aug., 08:15, Michael Ignatov <migna... at chemistry.ohio-state.edu> wrote: > Hello everyone, > > I have ran into a problem of fitting my experimental data points to a > function in mathematica. > The function comes from a solution of five algebraic equations with 5 > variables. Very straight forward. Unfortunately cubic roots are present > in the solution so when the function is evaluated at fixed parameters it > always return a small imaginary part with the real part. The real parts > are quite meaningful and imaginary parts are extremely small. For all > practical purposes I can just drop the imaginary part. When I build a > model function, which is just a linear combination of 5 solutions, I can > evaluate it with fixed parameters and see that it describes my > experimental points rather well. But FindFit fails to perform a search > always stopping at the starting value. Any ideas on how to either drop > imaginary part of the function completely or make FindFit work with a > function that returns complex numbers? > > Thanks a lot for your time, > Michael