MathGroup Archive 1997

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

Search the Archive

Re: Fitting Explicit Functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg6824] Re: [mg6780] Fitting Explicit Functions
  • From: Richard Finley <trfin at fiona.umsmed.edu>
  • Date: Mon, 21 Apr 1997 02:03:14 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Todd, 

I don't know the form of your data or the range, but it would seem a lot
more straightforward if you used an explicit form of your equation which is
simply:

y = -(x/b) Log[x]  

in which case you should be able to use the standard L-M algorithm. 

regards,
RF



At 02:37 AM 4/18/97 -0400, you wrote:
>From: culman at ohstpy.mps.ohio-state.edu
>Subject: [mg6780] Fitting Explicit Functions
>Organization: The Ohio State University, Department of Physics
>
>Hello,
>
>I would like to fit some data to an implicit function. I have data for x and y
>for the following equation:
>
>1/x = exp( b*y/x ).
>
>I would like to fit for b. It appears that one cannot use the
>Levenberg-Marquardt method in Mathematica because that method takes the 
>derivatives wrt the parameters explicitly. However, using the method of 
>steepest descent (FindMinimum), the derivatives are taken numerically, 
>so it should work. Nevertheless, I have not been able to do this.
>
>Below is an example. The data are such that the parameter b = -0.5. Does anyone
>have any ideas of how to do this in Mathematica?
>
>Thanks in advance,
>
>Todd Culman
>Physics Dept.,
>The Ohio State University
>
>
>
>
>In[1]:= f[x_,b_] :=Limit[y, FindRoot[1/x == Exp[b y/x], {y,1}]]
>In[2]:= data = {{0.5,-.693147},{1.,0.},{2.,2.7759},{3,6.59167}}
>In[3]:= << Statistics`NonlinearFit`
>In[4]:= NonlinearRegress[data,f[x,b],x,{b,-.1,-2},Method->FindMinimum]
>
>
>
>\!\(FindRoot::"frnum" \( : \ \) 
>    "Function \!\({\(\(-1.`\)\\ 2.71828182845904509`\^\(\(1.`\\ b\)\/x\)\) + \
>1\/x}\) is not a length \!\(1\) list of numbers at \!\({y}\) = \
>\!\({1.`}\)."\)
>\!\(Limit::"lim" \( : \ \) 
>    "Limit specification \!\(FindRoot[\(\(1\/x == \(Exp[\(\(b\\ \
>y\)\/x\)]\)\), \({y, 1}\)\)]\) is not of the form x -> x0."\)
>\!\(FindRoot::"frnum" \( : \ \) 
>    "Function \!\({\(\(-1.`\)\\ 2.71828182845904509`\^\(\(1.`\\ b\)\/x\)\) + \
>1\/x}\) is not a length \!\(1\) list of numbers at \!\({y}\) = \
>\!\({1.`}\)."\)
>\!\(Limit::"lim" \( : \ \) 
>    "Limit specification \!\(FindRoot[\(\(1\/x == \(Exp[\(\(b\\ \
>y\)\/x\)]\)\), \({y, 1}\)\)]\) is not of the form x -> x0."\)
>Thread::"normal": 
>    "Nonatomic expression expected at position \!\(1\) in \
>\!\(Thread[False]\)."
>FindRoot::"frnum": 
>    "Function \!\({\(\(-1.`\)\\ 2.71828182845904509`\^\(\(1.`\\ b\)\/x\)\) + \
>1\/x}\) is not a length \!\(1\) list of numbers at \!\({y}\) = \!\({1.`}\)."
>General::"stop": 
>    "Further output of \!\(FindRoot :: \"frnum\"\) will be suppressed during \
>this calculation."
>Limit::"lim": 
>    "Limit specification \!\(FindRoot[\(\(1\/x == \(Exp[\(\(b\\ \
>y\)\/x\)]\)\), \({y, 1}\)\)]\) is not of the form x -> x0."
>General::"stop": 
>    "Further output of \!\(Limit :: \"lim\"\) will be suppressed during this \
>calculation."
>First::"first": "\!\({}\) has a length of zero and no first element."
>Thread::"tdlen": 
>    "Objects of unequal length in \!\(\({b}\) \\[Rule] \({}\)\) cannot be \
>combined."
>Join::"heads": 
>    "Heads \!\(Rule\) and \!\(List\) at positions \!\(1\) and \!\(2\) are \
>expected to be the same."
>ReplaceAll::"reps": 
>    "\!\({Join[\(\(\({b}\) \\[Rule] \({}\)\), \({x \\[Rule] \*StyleBox[\"0.5`\
>\", Rule[PrintPrecision, 16], Rule[StyleBoxAutoDelete, True]]}\)\)]}\) is \
>neither a list of replacement rules nor a valid dispatch table, and so cannot \
>be used for replacing."
>Join::"heads": 
>    "Heads \!\(Rule\) and \!\(List\) at positions \!\(1\) and \!\(2\) are \
>expected to be the same."
>ReplaceAll::"reps": 
>    "\!\({Join[\(\(\({b}\) \\[Rule] \({}\)\), \({x \\[Rule] 0.5`}\)\)]}\) is \
>neither a list of replacement rules nor a valid dispatch table, and so cannot \
>be used for replacing."
>ReplaceAll::"reps": 
>    "\!\({Join[\(\(\({b}\) \\[Rule] \({}\)\), \({x \\[Rule] 0.5`}\)\)]}\) is \
>neither a list of replacement rules nor a valid dispatch table, and so cannot \
>be used for replacing."
>General::"stop": 
>    "Further output of \!\(ReplaceAll :: \"reps\"\) will be suppressed during \
>this calculation."
>NonlinearRegress::"nonnum": 
>    "The model is not numerical at \!\(Join[\(\(\({b}\) \\[Rule] \({}\)\), \
>\({x \\[Rule] \*StyleBox[\"0.5`\", Rule[PrintPrecision, 16], \
>Rule[StyleBoxAutoDelete, True]]}\)\)]\).  Check that all model parameters are \
>included in the parameter list."
>NonlinearRegress[{{0.5,-0.693147},{1.,0.},{2.,2.7759},{3,6.59167}},
>  Limit[y,FindRoot[1\/x==Exp[b y\/x],{y,1}]],x,{b,-0.1,-2},
>  Method\[Rule]FindMinimum]
>
>



  • Prev by Date: Strange Compile Results
  • Next by Date: Re: Matrix norms? ..
  • Previous by thread: Re: Fitting Explicit Functions
  • Next by thread: Re: Fitting Explicit Functions