Error and Complementary Error Functions
M.M. Yovanovich
ERFERFC.MWS
Error and complementary error functions.
These important special functions are defined as and .
Maple can handle these two special functions which appear in solutions of the one-dimensional diffusion equation in a half-space . These functions are solutions of the second-order ordinary differential equation .
Some characteristics and properties are presented in this worksheet.
> restart:
Plots of erf(z) and erfc(z).
> plot({erf(z), erfc(z)}, z = 0..3);
Some values of erf(z) and erfc(z) in the range z = 0 to 2.
> [seq(evalf(erf(z/10)), z = 0..20)];
> [seq(evalf(erfc(z/10)), z = 0..20)];
Relationship between erf(z) and erfc(z).
> simplify(erf(z) + erfc(z));
Derivatives of erf(z) and erfc(z).
> diff(erf(z), z);
> diff(erfc(z), z);
Integrals of erf(z) and erfc(z).
> int(erf(z), z);
> int(erfc(z), z);
Series expansions of erf(z) and erfc(z).
> series(erf(z), z, 9);
> series(erfc(z), z, 9);
Erf(z) and erfc(z) satisfy a second-order ODE.
> y1:= erf(z); y2:= erfc(z);
> diff(y1, z$2) + 2*z*diff(y1, z);
> diff(y2, z$2) + 2*z*diff(y2, z);
Solution of second-order ODE.
> ode:= diff(y(z), z$2) + 2*z*diff(y(z),z) = 0;
> solode:= dsolve(ode, y(z));
Complex argument.
> z1:= 2 + I*2: evalf([erf(z1), erfc(z1)]);
Polynomial approximation of erf(w) with maximum absolute error less than 2.5e-5.
> restart:
> erfapp:= 1-(t*(a1 + t*(a2 + a3*t)))*exp(-w^2);
> t:= 1/(1 + p*w);
>
coefs:=
(p = 0.47047,
a1 = 0.3480242,
a2 = -0.0958798,
a3 = 0.7478556);
> erfapp:= subs(coefs, erfapp);
> evalf(subs(w = 0.5, erfapp)); erf(0.5);
The polynomial approximation provides acceptable accuracy for engineering applications.