[Newbie] expansion of a function as a power series



On 7/25/07, Daniel Lakeland <dlakelan at street-artists.org> wrote:
> > > You compute the nth derivative of your function and evaluate it at the
> > > expansion point, then divide by n!

As Fateman points out, it is usually much more computationally
expensive to calculate an nth derivative than to calculate the first n
terms of the taylor series.  It is in fact often the case that the
methods used in derivations and proofs are not the best to use
computationally.

What's more, calculating the derivative and evaluating is also
trickier: in general, you may have to use limit, which adds more
computation:

    ex: x/sin(x)$
    exd4: diff(ex,x,4)$
    subst(0,x,exd4) => Divison by 0
    limit(exd4,x,0) => 7/15

And, interestingly enough, one of Maxima's methods for calculating
limits (tlimit) in fact uses the taylor package....

Things are even messier in other cases (Laurent):

    ex: 1/sin(x)$
    exd1: diff(ex,x)$
    subst(0,x,exd1) => Division by 0
    limit(exd1,x,0) => minf                     Hmm.
    ratcoeff(taylor(exd1,x,0,1),x,1) => 1/6

                  -s