Yes, I think that was the problem here. It is always a good idea to add a small amount to stay in the safe zone: log(1e-10 + x),...sqrt(1e-10 + x). Hans > > Any explanation why this is? Does having the base of the pow( ) > function equal to 0.0 mess up differentiability in some weird way? >