Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: LevenbergMarquardt

  • To: mathgroup at smc.vnet.net
  • Subject: [mg86626] Re: LevenbergMarquardt
  • From: David Bailey <dave at Remove_Thisdbailey.co.uk>
  • Date: Sat, 15 Mar 2008 17:42:14 -0500 (EST)
  • References: <frasd4$1ip$1@smc.vnet.net>

Ausman, Kevin wrote:
> I want to thank everyone who replied to my earlier questions. I think I 
> am getting closer to solving my problem. Unfortunately, I have run into 
> another issue.
> 
> Here is what I am trying to do:
> 
> result=FindMinimum[Sum[residFunc[xptData,testInstFunc,0,t,numRateConst,
> rateConst/.{kauto=AEk1float,icauto=AEic1float},numInitConc,ic/.{kauto=AEk
> 1float,icauto=AEic1float},ec/.{kauto=AEk1float,icauto=AEic1float},rateEq,
> finalTime][[i]]^2,{i,1,Length[xptY]}],{{k1float,6000},{ic1float,0.003}},Method=AELevenbergMarquardt]
> 
> The problem is that without specifying LevenbergMarquardt as the method 
> I get an error that the gradient is effectively zero, but when I do 
> specify Levenberg Marquardt it says that my function isn't of the 
> appropriate form:
> 
> FindMinimum::notlm : The objective function for the method 
> LevenbergMarquardt must be in a least-squares form: 
> Sum[f[i][x]^2,{i,1,n}] or Sum[w[i] f[i][x]^2,{i,1,n}] with positive 
> w[i].
> 
> It looks to me as though I have a sum of squares, and I know from 
> experience (programming in Fortran many years ago) that 
> LevenbergMarquardt is the way to go for this particular problem.
> 
> The parameters for residFunc are some experimental data and some fitting 
> paramters (typically in lists), and it returns a one-dimensional list of 
> numbers.
> 
> Help?
> 
> Kevin Ausman
> 
This is a bit of a wild guess, because the code that you have posted is 
not really runnable. Note that FindMinimum has attributes HoldAll, so it 
takes its argument unevaluated and will look to see if it is of the 
specified form *** before trying to evaluate it ***. Your expression 
certainly is not an explicit sum of squares, though it may evaluate to 
one. You will need to generate an expression which is explicitly in the 
stated form, and then splice it into FindMinimum using 
With[{z=expr},FindMinimum[............

I would also echo a previous answer - FindFit is almost certainly the 
way to go.

David Bailey
http://www.dbaileyconsultancy.co.uk


  • Prev by Date: Re: Pi is not a real number?
  • Next by Date: The size of a 3D plot
  • Previous by thread: RE: Re: LevenbergMarquardt
  • Next by thread: Re: Accessing and using built-in constants in Mathematica