       Re: Using LevenbergMarquardt Method with a complicated function

• To: mathgroup at smc.vnet.net
• Subject: [mg52799] Re: Using LevenbergMarquardt Method with a complicated function
• From: iguess at noreply.com (guess)
• Date: Mon, 13 Dec 2004 04:23:15 -0500 (EST)
• References: <c42fu1475r5h@legacy>, <v8ou5u4a7soi@legacy>
• Sender: owner-wri-mathgroup at wolfram.com

``` From the message, I guess ChiSQ can allow only one Sum when using
LevenbergMarquardt method in FindMinimum. Did you try to mimic that
there is only one Sum[] function?

On 9 Dec 04 06:09:46 -0500 (EST), algaba wrote:
>Hi.
>I have defined a very long function like this:
>
>ChiSquare[Per0_?NumericQ, Ppa0_?NumericQ, Ecc0_?NumericQ] :=
>
> (some steps and definitions here)
>
>ChiSQ = Sum[ResAlpha[[i]]^2 + ResDelta[[i]]^2, {i, 1, Length[
>            TExp]}] + Sum[ResAlphaComp[[i]]^2 +
>           ResDeltaComp[[i]]^2, {i, 1, Length[TComp]}]);
>
>which tries to find the Chi-Square of an array of data. Now, I want
to
>minimize it and I use FindMinimum, which works well. The problem
>arises when I want to use the Levenberg-Marquardt method, which seems
>to be better for this kind of functions (As you can see, it is a sum
>of squares) But when I run Mathematica 5 it gives me the next error
>message:
>
>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].
>
>I think the function accomplishes all the requirements. Why I get
this
>error? Is it maybe because of the long definition of the function? Is
>it because Mathematica doesn't see this function as a sum of squares
>but as a sequence of steps?
>What can I do to solve this problem? I do want to use this method to
>minimize the Chi-Square. Thanks.
>
>
>******************************************
>algaba at alumni.uv.es
>Universitat de Valencia
>Departamento de Astronomía y Astrofísica

```

• Prev by Date: Re: Sorting question
• Next by Date: Re: multiple outputs from a function
• Previous by thread: Re: Using LevenbergMarquardt Method with a complicated function
• Next by thread: Re: Using LevenbergMarquardt Method with a complicated function