MathGroup Archive 2011

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

Search the Archive

Re: Strange behaviour of NMinimize when doing curve fitting

  • To: mathgroup at
  • Subject: [mg120717] Re: Strange behaviour of NMinimize when doing curve fitting
  • From: Peter Pein <petsie at>
  • Date: Sun, 7 Aug 2011 06:15:03 -0400 (EDT)
  • Delivered-to:
  • References: <j1im4n$cni$>

Am 06.08.2011 08:14, schrieb Hovhannes Babayan:
> Hello,
> I want to fit a set of points with some curve, which form I know, but coefficients have to be determined to make the best possible fit. Also, for the each point a weight (a number ranging from 0 to 1) is defined. Point with greater weight is more important and point with lower weight is not so important. Point with weight=0 doesn't matter at all, point with weight=1 is extremely important.
> The code below uses NMinimize and draw the best fit graphic.
> The function f[r_, z_, u_, a_, b_] is a fitting function, where z,u,a,b are parameters.
> The question is following. Notice that I've used a/110 and b/100, instead of just a and b. When I use just a and b, produced curve doesn't fit at all my points. When I use a/50 and b/50 result is better, with a/70 and b/70 even better, and so on. The best seems to be a/110 and b/100 combination. Why it is so important for NMinimize??
>>From theoretical point of view it absolutely doesn't matter what is used: a/100 or a/1000 or just a. Parameter "a" should be found in every case.
> Please, if you have met such behavior, let me know, because currently I am doing NMinimize of NMinimize just to find good values to divide a and b, and it has no sense :)
> In order to try the code below, just copy/paste it into Mathematica, it should print best fit result (first element is error, second element is array with values of parameters z,u,a,b), should plot points and fitting curve. Use a/1 and b/1 to have the worst result and a/110 and b/100 to have good result.
> Thanks forehand for any suggestions, remarks and/or ideas.


 as you can see in this notebook [1], there is no more difference in the
results, when rationalizing the input and restricting u to be positive
and the other variables to be nonnegative.



  • Prev by Date: NMinimize eats all memory b/c of unnecessary symbolic work
  • Next by Date: Re: TransformedDistribution, distribution of a mean
  • Previous by thread: Strange behaviour of NMinimize when doing curve fitting
  • Next by thread: Re: Strange behaviour of NMinimize when doing curve fitting