Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Apparent accuracy error in least squares fit

  • To: mathgroup at smc.vnet.net
  • Subject: [mg66254] Re: [mg66206] Re: Apparent accuracy error in least squares fit
  • From: Daniel Ortega <daniel.ortega at uca.es>
  • Date: Fri, 5 May 2006 05:03:32 -0400 (EDT)
  • Organization: Universidad de Cádiz
  • References: <e346pr$7rn$1@smc.vnet.net> <e39kgv$cqu$1@smc.vnet.net> <200605040920.FAA09491@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Of course, I told you that with this dataset, the program worked. The trouble 
appears when the experimental values are lower; for instance:

{300., 2.7933}, {350., 2.7832}, {400., 2.7452}, {450., 2.6898}, 
{500., 2.5623}, {550., 2.3616}, {600., 2.0242}, {650., 1.5675}, 
{700.,1.0732}, {740., 0.693}}

Using them, the fitting procedure diverges, throwing the message:

FindRoot::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 merit function.  You may need more than 
\
MachinePrecision digits of working precision to meet these 
tolerances.

Thank you very much Chris.

El Jueves, 4 de Mayo de 2006 11:20, escribió:
> Here is what I get. There are no error messages.
>
> In[1]:=
> $Version
> Out[1]=
> 5.2 for Microsoft Windows (June 20, 2005)
> In[2]:=
> f[T_,Ms_]=Ms-Mo*Coth[(a+b*Ms)/T]+Mo*T/(a+b*Ms)
> Out[2]=
> \!\(Ms + \(Mo\ T\)\/\(a + b\ Ms\) - Mo\ Coth[\(a + b\ Ms\)\/T]\)
> In[3]:=
> data={{300.,2.7933},{350.,2.7832},{400.,2.7452},{450.,2.6898},{500.,
>
> 2.5623},{550.,2.3616},{600.,2.0242},{650.,1.5675},{700.,1.0732},{740.,
>       0.693}}
> Out[3]=
> {{300.,2.7933},{350.,2.7832},{400.,2.7452},{450.,2.6898},{500.,2.5623},{550
>., 2.3616},{600.,2.0242},{650.,1.5675},{700.,1.0732},{740.,0.693}} In[4]:=
> g=Apply[Plus,Map[Sqrt[f[#[[1]],#[[2]]]^2]&,data]];
> In[5]:=
> {sol1,sol2}=NMinimize[{g,0<a,0<b,Mo>0},{a,b,Mo}]
> Out[5]=
> {3.41302,{a\[Rule]17.3187,b\[Rule]6.81003,Mo\[Rule]91.5214}}
> In[6]:=
> data={{300.,9.4478},{350.,9.1237},{400.,8.6531},{450.,8.0999},{500.,
>
> 7.4426},{550.,6.706},{600.,5.8785},{650.,4.9522},{700.,3.8981},{750.,
>       2.9685}}
> Out[6]=
> {{300.,9.4478},{350.,9.1237},{400.,8.6531},{450.,8.0999},{500.,7.4426},{550
>., 6.706},{600.,5.8785},{650.,4.9522},{700.,3.8981},{750.,2.9685}} In[7]:=
> g=Apply[Plus,Map[Sqrt[f[#[[1]],#[[2]]]^2]&,data]];
> In[8]:=
> {sol1,sol2}=NMinimize[{g,0<a,0<b,Mo>0},{a,b,Mo}]
> Out[8]=
> {0.479589,{a\[Rule]0.00152594,b\[Rule]194.249,Mo\[Rule]11.3153}}

-- 
Daniel Ortega Ponce


  • Prev by Date: Re: Root's third argument?
  • Next by Date: Re: Root's third argument?
  • Previous by thread: Re: Apparent accuracy error in least squares fit
  • Next by thread: Re: Re: Apparent accuracy error in least squares fit