seemed to do that job. Not sure though, whether I am doing this correctly. Now the question is i dod have sqrt in my least squares operation. But why should it matter? It is not doing a closed form differentiation anyway. So for finite difference it should not matter at all. Right?