taylor expansion in 1D



try deftaylor(f(x),sum(a[i]*x^i,i,0,inf));
taylor(f(x+e),x,0,4);
 

> -----Original Message-----
> From: maxima-bounces at math.utexas.edu 
> [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Barton Willis
> Sent: Monday, July 21, 2008 1:01 PM
> To: Edwin Woollett
> Cc: maxima mailing list
> Subject: Re: [Maxima] taylor expansion in 1D
> 
> -----maxima-bounces at math.utexas.edu wrote: -----
> 
> >Can I use taylor(...) with extra massaging to
> >generate a formal expansion like;
> >
> >f(x + e)  --> f(x)  + e* 'diff( f(x), x, 1)
> >                      + e^2 * 'diff( f(x), x, 2) / 2  + ...
> >
> >??  or can this be done with pdiff ?
> 
> I think pdiff makes these kind of calculations nicer, but 
> depending on what
> you need, maybe you don't need pdiff. Example:
> 
>  (%i1) taylor(f(x + e),e,0,2);
>  (%o1)
>  
> f(x)+(at('diff(f(x+e),e,1),e=0))*e+((at('diff(f(x+e),e,2),e=0)
)*e^2)/2+...
> 
> Substituting a value for 'e' gives an error (maybe atvalue 
> allows you to
> do such things, I don't know).
> 
>  (%i2) subst(e=1,%);
>  Attempt to differentiate with respect to a number: 1
> 
> Try again using pdiff:
> 
>  (%i4) load(pdiff)$
>  (%i5) taylor(f(x + e),e,0,2);
> 
>  (%o5) f(x)+f[(1)](x)*e+(f[(2)](x)*e^2)/2+...
>  (%i6) subst(e=1,%);
> 
>  (%o6) f[(2)](x)/2+f[(1)](x)+f(x)
> 
> >What about 2D?
> 
> Multi-variable expansions aren't all that different:
> 
>  (%i7) taylor(f(x + e1,y+e2),[e1,e2],0,1);
>  (%o7) f(x,y)+(f[(1,0)](x,y)*e1+f[(0,1)](x,y)*e2)+...
> 
> Barton (author of pdiff)
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>