Hi, I had previously been interested in implementing delta dirac function in pynac, especially for Laplace transform, so maybe I can give you a couple of references.
First of all, the (quite long) thread about this in the sage-devel group: http://groups.google.com/group/sage-devel/browse_frm/thread/91289956e4db80c6/368c6c89935b85ad?lnk=gst&q=delta+dirac+pynac#368c6c89935b85ad In the first response, Burcin had given a link to his (very basic) draft of the dirac_delta function that he sent me a couple of weeks ago. Moreover, I think another interesting thread is the one on the SymPy bugtracker: http://code.google.com/p/sympy/issues/detail?id=672 At the end of this thread, they have the DiracDelta implemented, so you can actually read some python code implementing dirac delta, although based on SymPy. I can't give references about Maxima, because I'm not able to understand LISP, so that would have been useless to me. My final comment is that, I have understood that I should better wait for SAGE 4.0 to come back with these kind of issues, because that would be the first release (if I got it right) with Pynac enabled (maybe by default?), and so after that we can start working on building something on top of it. I am not even sure if something in Pynac engine is not going under some rewriting or development. But I think that 4.0 is coming soon! I would be glad to hear your impressions and to be updated on your work :) Regards Maurizio On 2 Mag, 20:53, Golam Mortuza Hossain <gmhoss...@gmail.com> wrote: > Hi, > > On Sun, Apr 26, 2009 at 7:43 PM, Tim Lahey <tim.la...@gmail.com> wrote: > > I do it from a mathematical perspective. The code to do the variation > > itself is.... > > Thanks Tim. I played around further with current Sage to see what > stuffs need to be improved in implementing functional derivative in Sage. > I followed the mathematical definition that you did in maple. In Physics, > one takes the test-function to be Dirac delta (that's the only difference). > > I tried with the following simple implementation > ------------------------- > def fdiff(L, q): > """ > Functional Derivative > """ > var('epsilon'); > f(t) = function('dirac_delta',t) # Test function > > return diff(L.substitute(q=q+epsilon*f(t)), epsilon).substitute(epsilon=0) > > # Example usage: > > # Time and Position > var('t'); q(t) = function('q',t) > > # Lagrangian for Simple Pendulum > L = (diff(q(t),t))^2/2 - q(t)^2/2 > > # Action > S = integrate(L, t) > > # Euler-Lagrange equation directly follows from variation of action > fdiff(S,q) > -------------------------- > > In fact, above 'works' in current sage but only after misusing > current "substitute" method. > > To implement proper functional derivative in current Sage, > following stuffs need some work > > (1) Improved "substitute()": > > Currently, "substitute" works, if keyword is a symbolic variable. > It doesn't seem to work when keyword is a symbolic function. Does > anyone know whether there are other ways in Sage to substitute > a symbolic function by a symbolic expression? > > (2) dirac_delta(x): > > I am planning to use Sage to compute Poisson brackets where > I need functional derivative (with Dirac delta as test-function). > Maxima seems to have implemented Dirac delta (for Laplace > transform). Does anyone working in implementing Dirac delta > in Sage? (or in pynac?) > > I am planning to start working on the above two. However, I > will prefer to avoid any effort duplication. > > Thanks, > Golam --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---