# [Maxima] asymptotic expansion of the error function

Dmitry Shkirmanov piminusmeson at bk.ru
Thu Apr 26 01:08:33 CDT 2012

```Thanks for the suggestions, i defined the erfc_asymp function:

(%i1) erfc_asymp(z,n):=exp(-z^2)/(z*sqrt(%pi))* (1+sum((-1)^k *((2*k-1))!! / (2 * z^(2))^k,k,1,n))\$

(%i2) erfc_asymp(x+%i*y,2);

2

1               3              - (%i y + x)

(- ------------- + ------------- + 1) %e

2               4

2 (%i y + x)    4 (%i y + x)

(%o2)        -----------------------------------------------------

sqrt(%pi) (%i y + x)

It gives just what i need.

> What do you mean to "perform" the asymptotic expansion?  The formula
> you cite can certainly be expanded to any number of terms you want by
> simply specifying the upper bound, e.g.
>
>          sum(x^i, i, 1, 4)
>
> gives x+x^2+x^3+x^4.  The cited article also gives an explicit formula
> for the remainder, so you should be able to cut off the expansion in
> an appropriate place.
>
>              -s
>
> On Wed, Apr 25, 2012 at 09:32, Dmitry Shkirmanov <piminusmeson at bk.ru
> <mailto:piminusmeson at bk.ru>> wrote:
> Hello, list. Is there any way  to perform the asymptotic expansion of
> the error function for large argument in maxima?
>
> (see http://en.wikipedia.org/wiki/Error_function
> the first formula in the "Asymptotic expansion" section)
> A workaround might be something similar to (likely this is buggy)
>
> (%i33) erfc_asymp(e, x, n) :=
>     subst('erfc = lambda([s],
>       if freeof(x,s) then funmake('erfc, [s]) else
>        block([z : taylor(s, x, inf, n)], exp(-s2) * sum((-1)^k * (2*k+1)!! / (2 * z^(2*k)),k,0,n))), e)\$
>
> The stirling function (load("stirling")) works something like this.  Example
>
> (%i43) erfc_asymp(erfc(x), x, 3);
> (%o43)/T/  (1/2-3/(2*x2)+15/(2*x4)-105/(2*x6)+...)*%e^(-x2)+...
>
> (%i44) erfc_asymp(erfc(x + 1/x), x, 3);
> (%o44)/T/  (1/(2*%e2)-2/(%e2*x2)+49/(4*%e2*x4)-295/(3*%e2*x6)+23161/(48*%e2*x8)-101269/(60*%e2*x10)+6339529/(1440*%e2*x12)-25829911/(2520*%e2*x14)+...)*%e^(-x2)+...
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20120426/61df8d63/attachment.html>
```