Can you please help with the following. I would like to compute the sign of an expression:

Sign[Sqrt[2] σ + 
  E^((p - v0)^2/(2 σ^2))
    Sqrt[π] (p - v0) Erfc[(-p + v0)/(Sqrt[2] σ)]]

All 3 variables p, v0 and sigma are positive. Is there a way in which I can actually evaluate this expression?

I have deduced that for p higher or equal to v0 this expression is positive.

How can I check the sign of this expression when p is smaller than v0? For instance, assuming p goes to zero and sigma is 5 times smaller than v0?

Thanks a lot for your support, highly appreciated.


2 Answers 2


As $\sigma>0$ we can divide the expression by $\sigma$ without changing its sign. Then, defining $x=(p-v_0)/\sigma$, the expression becomes

Sign[Sqrt[2] + E^(x^2/2)*Sqrt[π]*x*Erfc[-x/Sqrt[2]]]

This expression seems to be positive for any $x\in\mathbb{R}$, so I'd say that the answer to your question is that your Sign[...] is always 1:

LogPlot[Sqrt[2] + E^(x^2/2)*Sqrt[π]*x*Erfc[-x/Sqrt[2]], {x, -1000, 10},
  WorkingPrecision -> 100, PlotRange -> All]

enter image description here

The asymptotes of your expression are

  • $\sqrt{2}/x^2$ for $x\to-\infty$, which is positive,
  • $2x\sqrt{\pi} e^{\frac{x^2}{2}}$ for $x\to+\infty$, which is positive.
  • $\begingroup$ @Roman, thank you so much. I managed to compute a limit by assuming p=0, sigma>0, as v0 goes to infinity and I get -sqrt(2)*sigma. Your solution is more elegant, thanks! $\endgroup$
    – Astrid
    Jan 17, 2021 at 13:18
  • $\begingroup$ @Daniel, thank you. I think it should either be multiplied by (-x) or have -x inside the Erfc function. Otherwise it returns -infinity. $\endgroup$
    – Astrid
    Jan 17, 2021 at 13:23
  • $\begingroup$ Sorry, I had made a typo, it should read : Erfc[ - x/(Sqrt[2])] and then: Limit[Sqrt[2] + E^(x^2/2) Sqrt[\[Pi]] x Erfc[-x/(Sqrt[2])], x -> -Infinity]what gives zero. I will delete the wrong comment. $\endgroup$ Jan 17, 2021 at 13:48

It seems that the sign of the expression is more complex, it is not always positive.

Clear[f, x0];
f[x_] := Sqrt[2] + E^(x^2/2)*Sqrt[π]*x*Erfc[-x/Sqrt[2]];
NMinimize[f[x], x];
x0 = %[[2, 1, 2]]
Plot[f[x], {x, x0 - 1, x0 + 1}, PlotPoints -> 400]
FindRoot[f[x], {x, x0}]

{-1.46626, {x -> -38.5039}}

{x -> -38.3605}

enter image description here

  • $\begingroup$ No, what you're seeing is an artefact of using insufficient WorkingPrecision. $\endgroup$
    – Roman
    Jan 18, 2021 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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