converting function to include vectors
I have the following function that is being called from an algorithm.
Code:
double rosen(double x[])
{
return (100*(x[1]-x[0]*x[0])*(x[1]-x[0]*x[0])+(1.0-x[0])*(1.0-x[0]));
}
however I have tried to adjust the function so that it is mine:
Code:
double rosen(double x[])
{
double c[5];
double Fitted_Curve[5];
int i;
double Actual_Output[5]={1.2, 2.693, 4.325, 6.131, 8.125};
double Input[5]={1, 2, 3, 4, 5};
for (i = 1; i < 5; i++)
{
c[i] = -1/atanh((exp(x[0]*2*pi)-cosh(x[0]*x[1]*Actual_Output[i]))/sinh(x[0]*x[1]*Actual_Output[i]));
Fitted_Curve[i] = (1/(x[0]*x[1]))*(c[i]-asinh(sinh(c[i])*exp(x[0]*Input[i]*2*pi)));
}
}
I am trying to minimize the parameters x[0], x[1] and x[2]. i need to tell it the vectors Actual_Output and Input.
the original code had no vectors except the ones it was solving for, so i am not sure how to return my function.