Re: Series is taking too long

• To: mathgroup at yoda.physics.unc.edu
• Subject: Re: Series is taking too long
• From: keiper
• Date: Sat, 23 Jan 93 11:06:11 CST

```The problem is that evaluating series by repeatedly taking derivatives is
always slow.  Most of the special functions have rules attached to them
for evaluating their series expansion quickly.  These rules are defined in
StartUp/Series.m.  Unfortunately when I wrote this file I neglected to
include rules for the series expansion of Erf about the origin.  The
rules should be

Erf /: Series[Erf[z1_],{z_,aa_,nn_Integer}] :=
Erf[Series[z1, {z,aa,nn}]]/; nn >= 0

Erf /: Literal[Erf[s_SeriesData]] :=
Module[{f0 = faas[s], t},
fs = Integrate[E^(-(f0 + t + O[t]^mterms[1, s])^2), t];
Erf[f0] + 2/Sqrt[Pi] ComposeSeries[fs, s-f0]] /;
simser[s] && s[[4]]>=0

Note that the functions faas[ ], mterms[ ], and simser[ ] are defined
in the file StartUp/Series.m in a private context.  The above rules should
either be added to that file (within the private context) or the full names
SpecialFunctions`Series`Private`faas[ ]
SpecialFunctions`Series`Private`mterms[ ]
SpecialFunctions`Series`Private`simser[ ]
should be used.

In[8]:= Timing[Series[D[(Pi^(1/2)*(-z^2)^(1/2)*Erf[(-z^2)^(1/2)])/
(E^z^2*z),z],{z,0,25}]]

4       6       8       10
2   8 z    16 z    32 z    64 z
Out[8]= {2.86667 Second, -2 + 4 z  - ---- + ----- - ----- + ------ -
3      15      105     945

12        14        16         18         20           22
128 z     256 z     512 z     1024 z     2048 z       4096 z
>     ------- + ------- - ------- + -------- - --------- + ----------- -
10395    135135    2027025   34459425   654729075   13749310575

24
8192 z           26
>     ------------ + O[z]  }
316234143225

The next version of Mathematica will include these and other rules in
StartUp/Series.m

Jerry B. Keiper
keiper at wri.com

```

• Prev by Date: Simulated Annealing in Mma
• Next by Date: interpolation of unevenly sampled points
• Previous by thread: Series is taking too long