I am experiencing something very strange. As a result of a long calculation I obtain combination of functions of the type
Exp[-b t] Erfc(b x- t/x), where Erfc is the complimentary error function, b and t real parameters (b>0) and x some one dimensional variable.
I order to exhibit some symmetry I would like to use the identity Erfc(z)=1-Erf(z), where now Erf is the error function.
If I plot Erfc(b x- t/x) and 1-Erf(b x- t/x) as a verication, it is clear that things work.
However, plotting Exp[-b t] ( 1-Erf(b x- t/x) ) things get crazy for t<0, where the plot shows some weird oscillatory behaviour and goes rapidly to zero. In the attached picture, the plot shows:
(Red) Exp[-b t] Erfc(b x- t/x)
(Black) Exp[-b t] ( 1 - Erf(b x- t/x) )
So I am kind of puzled here … am I doing something trivially wrong or is it a bug of Mathematica ?
This is caused by the limited accuracy of floating point numbers. It happens in every programmig language on every computer that uses floating point numbers - which is basically all of them. You can read more about floating point numbers and problems like the one you are seeing online. There are many ways of working around this. The simplest is to redefine your function so that it doesn’t return such small values, which are prone to problems with floating point numbers. You may also consider using the WorkingPrecision option in Plot to work with a higher precision when doing the calculations.
If you’d still like help, what is the equation you plotted that did this?