On Thu, Apr 23, 2009 at 7:18 PM, Alex Raichev <tortoise.s...@gmail.com> wrote: > > Hmm, implementing the chain rule is trickier than i thought. My > straightforward plan of attack was to write a function that > differentiates a symbolic expression as usual but when it comes to a > composition f o g, it uses the chain rule and returns the appropriate > entry of the matrix (Df o g)Dg. Problems: > > (a) How do you split apart a symbolic expression to scan for > compositions? > (b) How do you construct Df so that you can compose it with g? > > Both thwart me and my white belt Sage-fu. > > Any helpful suggestions for (a), (b), or the general project? > > Alex
Picking apart expressions will change significantly soon in Sage, when we switch over to using Pynac for basic symbolic manipulation. The plan is to do this switch by May 15. -- William > > > On Apr 23, 1:43 pm, Alex Raichev <tortoise.s...@gmail.com> wrote: >> Never mind. I'll just right a short recursive function. It's easy >> enough. >> >> Alex >> >> On Apr 23, 11:10 am, Alex Raichev <tortoise.s...@gmail.com> wrote: >> >> > Hi all: >> >> > Do any of you know how to get Sage to use the chain rule and expand >> > the derivative of a composition involving one or two callable symbolic >> > functions? Here's an example with one callable symbolic function. >> >> > ---------------------------------------------------------------------- >> > | Sage Version 3.4, Release Date: 2009-03-11 | >> > | Type notebook() for the GUI, and license() for information. | >> > ---------------------------------------------------------------------- >> > sage: var('x,y,t') >> > (x, y, t) >> > sage: f= function('f',x,y) >> > sage: g= exp(I*t) >> > sage: diff(f(g,g^2),t).expand() >> > diff(f(e^(I*t), e^(2*I*t)), t, 1) >> >> > ------------------------------------------------------------------------ >> >> > The reason i ask is that i have to take higher-order derivatives of a >> > composition f o g of two callable symbolic multivariate functions. I >> > want the expanded form so that i can evaluate at a certain point c >> > and solve a linear system to get the derivatives of f at g(c). (I >> > know the values of the derivatives f o g and g at c.) I could write a >> > Sage function to expand the derivatives of f o g using Faà di Bruno's >> > formula, but before i do so, i was wondering if there's an easier >> > way. >> >> > Alex > > > -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---