On Apr 26, 2009, at 6:26 PM, Golam Mortuza Hossain wrote:
> > Hi Tim, > > On Sun, Apr 26, 2009 at 3:36 PM, Tim Lahey <tim.la...@gmail.com> > wrote: >> I decided to wait until pynac had stabilized a bit and was better >> integrated into the Sage which appears to be around the 4.0 >> timeframe. >> Plus, I've been busy with other things. I have code that I >> implemented >> in Maple and I've been look at porting it. > > Thanks for the update. I am wondering whether your code in maple > follows > physicist's approach in evaluating functional derivative? In > particular, > whether you consider Dirac delta function as a test function? > I do it from a mathematical perspective. The code to do the variation itself is: # Creates a variational equation based upon an input expression of # exprIn and the variation is with respect to the function # "func". It returns a list of the possible derivatives of the # variation as well as the variational equation. variationalEq := proc(exprIn,func::function) local varfunc,diffExpr,variedExpression,epsV,depsExpr,varEq,functionVars, orderList,difflist,dl,dvarFunc,i; # create a variation function by adding a delta prefix to the function name varfunc := prefixFuncname(func,"delta_"); # Make sure we have things in diff form diffExpr := convert(exprIn,diff); # vary the function variedExpression := subs(func=func+epsV*varfunc,exprIn); # differentiate with respect to epsV (epsilon) depsExpr := diff(variedExpression,epsV); # variation is when epsV=0 varEq := subs(epsV=0,depsExpr); return varfunc, varEq; end proc: Consider the above to be GPL V2. That's what I'm planning to release the code under in the end. Technically, there is cases where this approach breaks down and I should use limits and the limit definition of the derivative, but this works for the cases I use it for. This gets me a variational expression and the variation function. The hard part is working with it. I'm sure there is a lot to critique about the code and a mathematician could do a better job, but it works for me. I hope this helps. Cheers, Tim. --- Tim Lahey PhD Candidate, Systems Design Engineering University of Waterloo http://www.linkedin.com/in/timlahey --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---