A gradient descent minimizer just follows the negative gradient of the function at its current location. You (probably) gave the minimizer starting (p,delta)
values where the negative gradient had delta increasing. For different starting values, you will likely see different behavior.
One thought, though. Because erfc( (x-p)/delta )
has the ratio of p/delta
, your parameters are somewhat interdependent. That is, for small values of x
, or large values of p/delta
, the ratio will dominate, and minimizers can get stuck in a cycle of continually increasing the magnitude of the numerator and the denominator.
Try using modified parameters: erfc( x/delta - pdratio )
, and fitting to delta
and pdratio
. You can then back out the original p
parameter: p = pdratio*delta
.