help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] subscribe


From: Max Belushkin
Subject: Re: [Help-gsl] subscribe
Date: Wed, 07 Dec 2005 01:36:47 +0100
User-agent: Thunderbird 1.5 (X11/20051025)

The definition of a gradient is simple: it's a vector consisting of derivatives in each parameter.

So, if you have f(p1, p2, ..., pm), your gradient will be:
{df/dp1; df/dp2; ...; df/dpm}

You just need to take numerical derivatives in each of the parameters (taking a numerical derivative in p1 is no different from p2, given your function is smooth in all parameters), and construct a vector out of them - the GSL docs on multidimensional minimization address that. In the gradient, by definition, you have individual derivatives, treating other *independent* parameters as fixed at this point in parameter space.

If some parameters depend on others, eliminate them from the minimization routine - solve equations for them each iteration, but don't treat them as parameters you are fitting with.

address@hidden wrote:
Thanks for the reply,
I thought about it, but I don't think it works, because doing a numerical
differentiation will be only possible for one free parameter, not for 5
parameters. How can I do that since I am not fixing any of the 5
parameters? Any comments are welcome?
Hassan



Actually, on second thought, this might work, perhaps?

You can numerically compute your f(x,p1,p2,...). You have a bin of
values you're fitting to - f_x1, f_x2, ..., f_xN (i.e. samples of
another function at some points).

If you take a function to minimize as sum_{1}^{N}
(f(x_i,p1,p2,...)-f_xi)^2, you have a function C(p1,p2,...).

Now, if THAT is smooth as a function of p1, p2, ..., pm, you can easily
compute derivatives of it in p1, p2, ..., pm numerically using GSL, so
you don't need any explicit knowledge about your histogram functions'
derivatives.

Or did I mis-understand something else?

Max Belushkin wrote:
Ah, I see. Well, unless there's some clever way of numerically computing
the gradient of that, I'd go with James' suggestion and use a simplex
method...

address@hidden wrote:
My model function is attached in a dvi file to this email. I am
completely
not sure what do you mean by (.... the actual function you're "fitting"
doesn't matter, since chi squared is a sum over the whole range(s) of
the
squares of the function values minus the data bin (i.e. experimental
data)....). Can you clarify,please?  Any library that I try to use
invloves derivatives, abut I don't know the derivatives of my histogram
par of the functiont?!
Thank you for your response.
Hassan



     I'm not sure I understand what you're trying to do 100%, but,
generally, for any regression, you choose a function to minimize -
i.e.
chi squared. That takes some parameters over which you're minimizing,
and, if one is lucky, is continuous in those parameters - then you
need
to take the derivatives in parameters, the actual function you're
"fitting" doesn't matter, since chi squared is a sum over the whole
range(s) of the squares of the function values minus the data bin
(i.e.
experimental data). Well, I lost the experimental errors in there.

   So, how are you composing your function to be minimized? Is it
somehow  discretized in terms of the parameters?

   I think a bit more information on how you're trying to get to the
end
result would be helpful.

address@hidden wrote:
Hello,
I was looking for a non-linear fitting algorithm, and the manual only
covers Algorithms with Derivatives, but unfortunatly this does not
apply
for code as I have a histogram convolved with a Gaussian as my
fitting
function. Is there any Algorithm without Derivatives that I may use
in
GSL, and if not what other software that maight be helpful, knowing
that
I
only program in C. Thank you in advance for your response.
Sincerely,
Hassan
----------------------------------------------
Hassan Saadaoui,
PhD candidate,
TRIUMF
4004 Wesbrook Mall
Vancouver, B.C.
Canada V6T 2A3
1-604-222-1047, ext. 6194
----------------------------------------------



_______________________________________________
Help-gsl mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-gsl

Sincerely,
Hassan

----------------------------------------------
Hassan Saadaoui
TRIUMF
4004 Wesbrook Mall
Vancouver, B.C.
Canada V6T 2A3
1-604-222-1047, ext. 6194
----------------------------------------------

_______________________________________________
Help-gsl mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-gsl


_______________________________________________
Help-gsl mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-gsl



Sincerely,
Hassan

----------------------------------------------
Hassan Saadaoui
TRIUMF
4004 Wesbrook Mall
Vancouver, B.C.
Canada V6T 2A3
1-604-222-1047, ext. 6194
----------------------------------------------





reply via email to

[Prev in Thread] Current Thread [Next in Thread]