Re: Apparent accuracy error in least squares fit

• To: mathgroup at smc.vnet.net
• Subject: [mg66206] Re: Apparent accuracy error in least squares fit
• From: "Chris Chiasson" <chris.chiasson at gmail.com>
• Date: Thu, 4 May 2006 05:20:15 -0400 (EDT)
• References: <e346pr\$7rn\$1@smc.vnet.net><200605020643.CAA23608@smc.vnet.net> <e39kgv\$cqu\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```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}}

```

• Prev by Date: Re: Selecting Many Things Rather Than Selecting One Thing FromMany
• Next by Date: Re: Function of function analytic definition
• Previous by thread: Re: Re: Apparent accuracy error in least squares fit
• Next by thread: Re: Re: Apparent accuracy error in least squares fit