I was trying to plot the asymptotic expansion of erfc(x) for some value of x:
exact[x_] := 1/Sqrt[\[Pi]]*Gamma[1/2, x^2];
seriesz[x_, n_] :=
Exp[-x^2]/(x*Sqrt[\[Pi]])
Sum[(-1)^m* (2 m - 1)!! /(2^m *x^(2 m)), {m, 1, n}];
x = 2;
mmax = 5*x;
Print[StringForm["Exact answer: ``", exact[1.0*x]]]
Show[Plot[{exact[x]}, {m, 0, mmax}, PlotStyle -> {Dashed, Red}], ListPlot[Table[{m, seriesz[x, m]}, {m, 0, mmax}]]]
but the series is always ends up much lower on the plot than the actual value. Instead of getting something where the series oscillates around the exact value, what I'm getting when I run this code is:
Exact answer: 0.0046777349810472645`
When what I'm looking for is this (which I get when I make this alteration to the code):
seriesz[x_, n_] := 0.00517 + Exp[-x^2]/(x*Sqrt[\[Pi]])*Sum[(-1)^m* (2 m - 1)!! /(2^m *x^(2 m)), {m, 1, n}];
Any advice what I'm doing wrong that the series isn't centered around the exact value and instead is centered around some smaller value?