Re: Nonlinear curve fit as a Button function fails quietly

*To*: mathgroup at smc.vnet.net*Subject*: [mg128413] Re: Nonlinear curve fit as a Button function fails quietly*From*: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>*Date*: Thu, 18 Oct 2012 02:33:46 -0400 (EDT)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*Delivered-to*: l-mathgroup@wolfram.com*Delivered-to*: mathgroup-newout@smc.vnet.net*Delivered-to*: mathgroup-newsend@smc.vnet.net

All, I apologize in advance for the complexity of the code I will paste below. I tried to simplify it as much as possible, but if I simplify it too much it does not replicate the problem. I am building a Maniplate in which I can manually shape a function until I have a reasonable approximation of a set of data. Once a reasonable approximation is found, I press a button and FindFit finishes off the job. This works only some of the time. When it doesn't work, pushing the button just appears to have no effect. I have verified that FindFit on its own returns a value in about 7 to 8 seconds on my computer. It also throws a FindFit::eit Message, complaining that the fit does not converge to the tolerance. The code pasted below takes several seconds to print the "started" message, then appears to do nothing else. The symbol fff never gets a value. Any suggestions would be quite welcome. Version 8.0.4 on Mac OSX 10.8. Try this: Here lst is your list Button["doit", Print["started"]; fff = FindFit[ lst, {(1/Log[10])*(20* Log[10^(Re[gain]/20)* Abs[\[Omega]^2/((I*\[Omega] - xx1)*((I*\[Omega] - xx2)^2 + yy2^2)*((I*\[Omega] - xx3)^2 + yy3^2)*((I*\[Omega] - xx4)^2 + yy4^2)*((I*\[Omega] - xx5)^2 + yy5^2))]]), {xx1 < 0, xx2 < 0, xx3 < 0, xx4 < 0, xx5 < 0, 0 < yy2 < Pi, 0 < yy3 < Pi, 0 < yy4 < Pi, 0 < yy5 < Pi}}, {{gain, 24.2}, {xx1, -0.444}, {xx2, -0.082}, {yy2, 0.71}, {xx3, -0.132}, {yy3, 0.865}, {xx4, -0.066}, {yy4, 1.785}, {xx5, -0.116}, {yy5, 2.63}}, \[Omega]]; Print[fff] ] Alexei BOULBITCH, Dr., habil. IEE S.A. ZAE Weiergewan, 11, rue Edmond Reuter, L-5326 Contern, LUXEMBOURG Office phone : +352-2454-2566 Office fax: +352-2454-3566 mobile phone: +49 151 52 40 66 44 e-mail: alexei.boulbitch at iee.lu