On 6/7/07, Randy LeVeque <[EMAIL PROTECTED]> wrote: > By the way, I'm just trying to figure out how sage does Taylor series. > Maybe you can pass this on to whoever the best person is to chat with about > this... > > In maple I can do things like > > > mtaylor(u(x+h,t+k),[h,k],3); > 2 > u(x, t) + D[1](u)(x, t) h + D[2](u)(x, t) k + 1/2 D[1, 1](u)(x, t) h > > 2 > + h D[1, 2](u)(x, t) k + 1/2 D[2, 2](u)(x, t) k > > > which is very convenient for numerical analysis when computing truncation > errors of finite difference methods (h and k are mesh widths in space and > time). In sage a general expansion of this sort doesn't seem possible even > in a single variable, e.g., > > sage: taylor(u(x+h),h,0,4) > x + h > > Apparently an undefined function like u(x) is taken to be the identity map?
To define a formal function, do u = function('u'). Then sage: u = function('u') sage: u(x + h) u(x + h) sage: diff(u(x+h), x) diff(u(x + h), x, 1) To get the Taylor expansion you would do this: sage: taylor(u(x+h),h,0,4) -- however -- this currently doesn't work in SAGE since we hadn't considered doing this yet. What happens is Maxima does the computation and outputs the following expression: 'u(x)+(?%at('diff('u(x+h),h,1),h=0))*h+(?%at('diff('u(x+h),h,2),h=0))*h^2/2+(?%at('diff('u(x+h),h,3),h=0))*h^3/6+(?%at('diff('u(x+h),h,4),h=0))*h^4/24 SAGE doesn't know yet how to parse the "at" function, so you get an error -- it will have to be added. [Note that I don't necessarily consider maxima the ultimate underlying engine for SAGE's symbolic computation capabilities -- but it does provide a very quick way for SAGE to have a powerful symbolic system for which a lot of subtle bugs have already been fixed (over the last 40 years of Maxima development). ] Definitely point out lots of things like this in your talk at SD4! -- William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/ -~----------~----~----~----~------~----~------~--~---