First, Please, keep in mind that I'm a programmer not mathematician, and I have a fair mathematical background.
I used optimization in Java to fit some observations to a trigonometric function, I tried the following optimizers: BOBYQA, CMA-ES, Powell, and Simplex to optimize the function as a scalar function, and also Levenberg-Marquardt and Gauss-Newton to optimize it as a vector function, I got good results for
$z = a.\sin(x)+b.\cos(y)$
, but for a non-linear relation like: $y = \cos(a.x)$ or $z = \sin(a.x) + \cos(b.x)$, the results are very unsatisfying and I have to choose an initial guess very close to the correct values of $a$ and $b$, and certainly this is not practical, example:
$y=6.4\cdot e^{5.5x}$
gives
$(6.39 \text{ and } 5.5)$ if the initial guess is set to $(7,7)$
and gives
$(2.07 \text{ and }5.5)$ for initial guess of $(8,8)$
and , certainly, this is a very bad guess. So I guess I need either of two choices:
- Find a method for selecting a very good initial guess
- Find a method for improving the optimizer so that it could get a good result even if the initial guess is not good.
Thanks
I finally got it, the problem was caused by falling in a local optimum, following is a short comparison between results I got from the mentioned algorithms:
I finally made the following algorithm to get reliable, accurate, and precise results:
This gave acceptable results