       Re: parameters problem in FindFit

• To: mathgroup at smc.vnet.net
• Subject: [mg92865] Re: parameters problem in FindFit
• From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
• Date: Thu, 16 Oct 2008 05:04:15 -0400 (EDT)
• Organization: The Open University, Milton Keynes, UK
• References: <gd4dl4\$bg2\$1@smc.vnet.net>

```gyzhou at 139.com wrote:

>   I get a list like this :
>     lis = {{12.5, 1.146}, {32, 1.145}, {50,
>    1.144}, {69, 1.1424}, {84.6,
>    1.139}}
> My aim is :
>   FindFit[lis,
>    a - (b x^2)/(c + x), {{a, 1.14}, {b, 0.0003}, {c, 300}}, x]
> As we can see, I want this list to be fitted using parameters a, b, c
> around 1.14, 0.0003, 300. However Mathematica gives { b, 10^8} and {c,
>    10^14} far from what I expect.I set "MaxIterations" to less times,
> but it doesn' t make sense.

If you plot your model with the parameters returned by FindFit, you will
see that the fit is quite good. OTHO, the choice of 300 for c seems to
be a poor choice (except if you have some compelling reason from the
physical situation your are modeling). Anyway, try to use different
methods as illustrated below and check the result on a graph.

In:= lst = {{12.5, 1.146}, {32, 1.145}, {50, 1.144}, {69,
1.1424}, {84.6, 1.139}};

In:= model = a - (b x^2)/(c + x);

In:= sol =
FindFit[lst, model, {{a, 1.14}, {b, 0.0003}, {c, 300}}, x]

Out= {a -> 1.14624, b -> 2.45466*10^8, c -> 2.59133*10^14}

In:= solar =
FindFit[lst, model, {a, b, c}, x,
"LevenbergMarquardt", "Newton", "QuasiNewton"}

During evaluation of In:= FindFit::lstol: The line search \
decreased the step size to within tolerance specified by AccuracyGoal \
and PrecisionGoal but was unable to find a sufficient decrease in the \
norm of the residual.  You may need more than MachinePrecision digits \
of working precision to meet these tolerances. >>

Out= {{a -> 1.14769, b -> 0.0000906534,
c -> 1.01529}, {a -> 1.14769, b -> 0.0000906534,
c -> 1.01529}, {a -> 1.14624, b -> 1.49101*10^8,
c -> 1.57403*10^14}, {a -> 1.14388, b -> 9.6559*10^-6,
c -> -37.5354}, {a -> 1.14769, b -> 0.0000906531, c -> 1.01317}}

In:= Plot[{model /. sol, model /. solar[],
model /. {a -> 1.14, b -> 0.0003, c -> 300}}, {x, 10, 100},
Epilog -> Point /@ lst]

In:= sol =
FindFit[lst, model, {{a, 1.14}, {b, 0.0003}, {c, 300}}, x,
"LevenbergMarquardt", "Newton", "QuasiNewton"}

During evaluation of In:= FindFit::lstol: The line search \
decreased the step size to within tolerance specified by AccuracyGoal \
and PrecisionGoal but was unable to find a sufficient decrease in the \
norm of the residual.  You may need more than MachinePrecision digits \
of working precision to meet these tolerances. >>

During evaluation of In:= FindFit::lstol: The line search \
decreased the step size to within tolerance specified by AccuracyGoal \
and PrecisionGoal but was unable to find a sufficient decrease in the \
norm of the residual.  You may need more than MachinePrecision digits \
of working precision to meet these tolerances. >>

During evaluation of In:= FindFit::lstol: The line search \
decreased the step size to within tolerance specified by AccuracyGoal \
and PrecisionGoal but was unable to find a sufficient decrease in the \
norm of the residual.  You may need more than MachinePrecision digits \
of working precision to meet these tolerances. >>

During evaluation of In:= General::stop: Further output of \
FindFit::lstol will be suppressed during this calculation. >>

Out= {{a -> 1.14637, b -> 0.000365391, c -> 300.}, {a -> 1.14637,
b -> 0.000365391, c -> 300.}, {a -> 1.14624, b -> 2.45466*10^8,
c -> 2.59133*10^14}, {a -> 1.14624, b -> 4.13776,
c -> 4.36807*10^6}, {a -> 1.14637, b -> 0.000365391, c -> 300.}}

HTH,
-- Jean-Marc

```

• Prev by Date: Re: Re: naive question
• Next by Date: Re: Newbie question: equations with sums.
• Previous by thread: Re: parameters problem in FindFit
• Next by thread: Partial Differential Equations