Hi all,
I would like to find the minimum of a likelihood function using minlbfgs_numdiff (numerical differentiation). Clearly, my function depends on an array of data (vvv[]).
I do not understand why it ends up in an infinite loop. Here is the driver I have created.
Have you got any suggestions, please?
Best,
A
Code:
void function1_func(const real_1d_array &x, double &func, void *ptr)
{
int i;
double a=0;
double s = 0;
double e=0;
double err=0;
for(i = 0; i<10; i++)
{
e= vvv[i]-x[0];
a= -0.5*log(2*PI)-0.5*(log(x[1])+(e*e)/x[1]);
s=s+a;
}
func= (s);
}