I am working with formulas containing the complementary error function. In those formulas, I have something like $$f(\mu, \sigma) = \frac{1}{2} \cdot e^{\mu + \frac{\sigma^2}{2}} \cdot \mathrm{erfc}\left(\frac{\mu + \sigma^2}{\sigma \sqrt{2}}\right)$$ for instance.

When assuming $\mu = 0$, this simplifies to $$f(0, \sigma) = \frac{1}{2} \cdot e^\frac{\sigma^2}{2} \cdot \mathrm{erfc}\left(\frac{\sigma}{\sqrt{2}}\right)$$ and the derivatives for this simplified function are $$\begin{align} \frac{\partial f(0, \sigma)}{\partial \mu} & = 0 \\ \frac{\partial f(0, \sigma)}{\partial \sigma} & = \frac{1}{2} \cdot \sigma e^\frac{\sigma^2}{2} \cdot \mathrm{erfc}\left(\frac{\sigma}{\sqrt{2}}\right) - \frac{1}{\sqrt{2 \pi}} \end{align}$$

In order to generalise this (also look at other $\mu$), I took a look at the derivatives of $f(\mu, \sigma)$ $$\begin{align} \frac{\partial f(\mu, \sigma)}{\partial \mu} & = \frac{1}{2} \cdot e^{\mu + \frac{\sigma^2}{2}} \cdot \mathrm{erfc}\left(\frac{\mu + \sigma^2}{\sigma \sqrt{2}}\right) - \frac{1}{\sigma \sqrt{2 \pi}} \cdot e^{-\frac{\mu^2}{2 \sigma^2}} \\ \frac{\partial f(\mu, \sigma)}{\partial \sigma} & = \frac{1}{2} \cdot \sigma e^{\mu + \frac{\sigma^2}{2}} \cdot \mathrm{erfc}\left(\frac{\mu + \sigma^2}{\sigma \sqrt{2}}\right) - \frac{\sigma^2 - \mu}{\sigma^2 \sqrt{2 \pi}} e^{-\frac{\mu^2}{2 \sigma^2}} \end{align}$$ and see what happens for $\mu = 0$, we find $$\begin{align} \frac{\partial f}{\partial \mu}(0, \sigma) & = \frac{1}{2} \cdot e^{\frac{\sigma^2}{2}} \cdot \mathrm{erfc}\left(\frac{\sigma}{\sqrt{2}}\right) - \frac{1}{\sigma \sqrt{2 \pi}} \\ \frac{\partial f}{\partial \sigma}(0, \sigma) & = \frac{1}{2} \cdot \sigma e^\frac{\sigma^2}{2} \cdot \mathrm{erfc}\left(\frac{\sigma}{\sqrt{2}}\right) - \frac{1}{\sqrt{2 \pi}} \end{align}$$

Now, the derivative with regard to $\sigma$ is the same, but for $\mu$, I have two equations.

Does this mean I have a mistake in my derivatives or is it normal. I can imagine that it has something to do with the fact that $\mu$ is set to zero - this obviously makes any $\mu$ dissapear in the equation, leading to the zero derivative, but now I was wondering whether something like that is wrong and/or wheter it makes sense to do something like this. Assuming that I would be especially interested in the case $\mu = 0$, am I allowed to say that the derivative is zero or should I always go with the second "general" formula?

PS: If anyone would happen to know a better title, feel free to edit...


We can do without partials to see what's wrong. Suppose $$f(x) = x.$$

Then $f'(x) = 1$, so $f'(0) = 1$.

On the other hand, $$f(0) = 0.$$ If one just takes the derivative of the $0$ on the right-hand side of the previous, one gets $0$ - which of course is not right, in that it is not $f'(0)$... Do you understand the problem? In any case, this is pretty much the issue with the manipulation (substitution before differentation) in your original question.

  • $\begingroup$ Am I right to say that it never makes sense to do something like this? I just noticed this in the documents I got from the supervisor of my master thesis and I was wondering whether it would make sense in some context... $\endgroup$ – Mr Tsjolder Nov 18 '16 at 14:27
  • $\begingroup$ I would say that it does not ever really make sense, certainly in the way you are proposing. Generally speaking, differentiation is a measure of how a function is changing. Partial differentiation adds a conceptual complexity: it's measuring the change of a function as you vary a particular variable $\mu$, and hold the others fixed. So if you first fix that desired variable $\mu$ (i.e., substitute a value for it), you are not measuring "how that function varies" as $\mu$ varies. OK? $\endgroup$ – peter a g Nov 18 '16 at 14:35
  • $\begingroup$ Rats - I put my quotation marks around the wrong thing in the previous - we try again: if you first fix $\mu$ (i.e., substitute a value for it), you are not measuring how the function varies "as $\mu$ varies" - because you've just fixed $\mu$. $\endgroup$ – peter a g Nov 18 '16 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.